svn commit: trunk/busybox/libbb

vodz at busybox.net vodz at busybox.net
Mon Feb 20 16:57:37 UTC 2006


Author: vodz
Date: 2006-02-20 08:57:36 -0800 (Mon, 20 Feb 2006)
New Revision: 14148

Log:
sync with mainstream, but check more

Modified:
   trunk/busybox/libbb/login.c


Changeset:
Modified: trunk/busybox/libbb/login.c
===================================================================
--- trunk/busybox/libbb/login.c	2006-02-20 16:31:44 UTC (rev 14147)
+++ trunk/busybox/libbb/login.c	2006-02-20 16:57:36 UTC (rev 14148)
@@ -37,7 +37,7 @@
 {
 	FILE *fd;
 	int c;
-	char buf[256];
+	char buf[256+1];
 	const char *outbuf;
 	time_t t;
 	struct utsname uts;
@@ -82,8 +82,8 @@
 
 					case 'D':
 					case 'o':
-						getdomainname(buf, sizeof(buf));
-						buf[sizeof(buf) - 1] = '\0';
+						c = getdomainname(buf, sizeof(buf) - 1);
+						buf[c >= 0 ? c : 0] = '\0'; 
 						break;
 
 					case 'd':
@@ -120,8 +120,8 @@
 {
 	char buf[MAXHOSTNAMELEN+1];
 
-	gethostname(buf, MAXHOSTNAMELEN);
-	fputs(buf, stdout);
+	if(gethostname(buf, MAXHOSTNAMELEN) == 0)
+		fputs(buf, stdout);
 
 	fputs(LOGIN, stdout);
 	fflush(stdout);




More information about the busybox-cvs mailing list