summaryrefslogtreecommitdiff
path: root/libbb/login.c
diff options
context:
space:
mode:
authorMike Frysinger2006-02-19 23:03:31 +0000
committerMike Frysinger2006-02-19 23:03:31 +0000
commitdce17c6268b16646f4918cc4f3ee84a0ea1c0e9c (patch)
tree9a8339a33eaec905274d931569d82d55e12c4d6a /libbb/login.c
parent294254ce6bd03047fb2ccf0549387cd1e2c3f0c5 (diff)
downloadbusybox-dce17c6268b16646f4918cc4f3ee84a0ea1c0e9c.zip
busybox-dce17c6268b16646f4918cc4f3ee84a0ea1c0e9c.tar.gz
rfelker writes in Bug 742: make sure string is null terminated after calling gethostname
Diffstat (limited to 'libbb/login.c')
-rw-r--r--libbb/login.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/login.c b/libbb/login.c
index 3f67a81..2d61625 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -96,6 +96,7 @@ void print_login_issue(const char *issue_file, const char *tty)
case 'h':
gethostname(buf, sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
break;
case 'l':
@@ -105,7 +106,7 @@ void print_login_issue(const char *issue_file, const char *tty)
default:
buf[0] = c;
}
- }
+ }
fputs(outbuf, stdout);
}