aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-02-19 23:03:31 +0000
committervapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-02-19 23:03:31 +0000
commit3870e985a96337e69ed33b89b27fe055e39189c9 (patch)
tree9a8339a33eaec905274d931569d82d55e12c4d6a
parentad39b4e5b8fa18e988ac0c086fe329f43f7b7884 (diff)
downloadbusybox-w32-3870e985a96337e69ed33b89b27fe055e39189c9.tar.gz
busybox-w32-3870e985a96337e69ed33b89b27fe055e39189c9.tar.bz2
busybox-w32-3870e985a96337e69ed33b89b27fe055e39189c9.zip
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
-rw-r--r--libbb/login.c3
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