diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-02-19 23:03:31 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-02-19 23:03:31 +0000 |
commit | dce17c6268b16646f4918cc4f3ee84a0ea1c0e9c (patch) | |
tree | 9a8339a33eaec905274d931569d82d55e12c4d6a /libbb | |
parent | 294254ce6bd03047fb2ccf0549387cd1e2c3f0c5 (diff) | |
download | busybox-w32-dce17c6268b16646f4918cc4f3ee84a0ea1c0e9c.tar.gz busybox-w32-dce17c6268b16646f4918cc4f3ee84a0ea1c0e9c.tar.bz2 busybox-w32-dce17c6268b16646f4918cc4f3ee84a0ea1c0e9c.zip |
rfelker writes in Bug 742: make sure string is null terminated after calling gethostname
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/login.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/login.c b/libbb/login.c index 3f67a819a..2d6162564 100644 --- a/libbb/login.c +++ b/libbb/login.c | |||
@@ -96,6 +96,7 @@ void print_login_issue(const char *issue_file, const char *tty) | |||
96 | 96 | ||
97 | case 'h': | 97 | case 'h': |
98 | gethostname(buf, sizeof(buf) - 1); | 98 | gethostname(buf, sizeof(buf) - 1); |
99 | buf[sizeof(buf) - 1] = '\0'; | ||
99 | break; | 100 | break; |
100 | 101 | ||
101 | case 'l': | 102 | case 'l': |
@@ -105,7 +106,7 @@ void print_login_issue(const char *issue_file, const char *tty) | |||
105 | default: | 106 | default: |
106 | buf[0] = c; | 107 | buf[0] = c; |
107 | } | 108 | } |
108 | } | 109 | } |
109 | fputs(outbuf, stdout); | 110 | fputs(outbuf, stdout); |
110 | } | 111 | } |
111 | 112 | ||