aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-02-20 16:31:44 +0000
committerRob Landley <rob@landley.net>2006-02-20 16:31:44 +0000
commit081d6d4380968dcbe90f66e31ba51ecce100998a (patch)
tree5210a3650324d0093bca21b9755d58b04ba220ce /libbb
parentb4ec339ac2959b2ec7d403be96efe026b0386ace (diff)
downloadbusybox-w32-081d6d4380968dcbe90f66e31ba51ecce100998a.tar.gz
busybox-w32-081d6d4380968dcbe90f66e31ba51ecce100998a.tar.bz2
busybox-w32-081d6d4380968dcbe90f66e31ba51ecce100998a.zip
getdomainname() isn't guaranteed to null terminate the string if it was
truncated for length. SVN 14135 made sure that the truncated version would always be null terminated. SVN 14144 broke this for no readily apparent reason, and I have no idea what it was even trying to accomplish. Reverted.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/login.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/login.c b/libbb/login.c
index 98799dc49..2d6162564 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -37,7 +37,7 @@ void print_login_issue(const char *issue_file, const char *tty)
37{ 37{
38 FILE *fd; 38 FILE *fd;
39 int c; 39 int c;
40 char buf[256+2]; 40 char buf[256];
41 const char *outbuf; 41 const char *outbuf;
42 time_t t; 42 time_t t;
43 struct utsname uts; 43 struct utsname uts;
@@ -82,8 +82,8 @@ void print_login_issue(const char *issue_file, const char *tty)
82 82
83 case 'D': 83 case 'D':
84 case 'o': 84 case 'o':
85 buf[0] = '\0'; 85 getdomainname(buf, sizeof(buf));
86 getdomainname(buf, sizeof(buf) - 1); 86 buf[sizeof(buf) - 1] = '\0';
87 break; 87 break;
88 88
89 case 'd': 89 case 'd':
@@ -95,8 +95,8 @@ void print_login_issue(const char *issue_file, const char *tty)
95 break; 95 break;
96 96
97 case 'h': 97 case 'h':
98 buf[0] = '\0';
99 gethostname(buf, sizeof(buf) - 1); 98 gethostname(buf, sizeof(buf) - 1);
99 buf[sizeof(buf) - 1] = '\0';
100 break; 100 break;
101 101
102 case 'l': 102 case 'l':
@@ -120,8 +120,8 @@ void print_login_prompt(void)
120{ 120{
121 char buf[MAXHOSTNAMELEN+1]; 121 char buf[MAXHOSTNAMELEN+1];
122 122
123 if(gethostname(buf, MAXHOSTNAMELEN) == 0) 123 gethostname(buf, MAXHOSTNAMELEN);
124 fputs(buf, stdout); 124 fputs(buf, stdout);
125 125
126 fputs(LOGIN, stdout); 126 fputs(LOGIN, stdout);
127 fflush(stdout); 127 fflush(stdout);