From 3870e985a96337e69ed33b89b27fe055e39189c9 Mon Sep 17 00:00:00 2001 From: vapier Date: Sun, 19 Feb 2006 23:03:31 +0000 Subject: rfelker writes in Bug 742: make sure string is null terminated after calling gethostname git-svn-id: svn://busybox.net/trunk/busybox@14135 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- libbb/login.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) 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); } -- cgit v1.2.3-55-g6feb