summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2013-01-29 00:52:02 +0000
committerKeith M Wesolowski <wesolows@foobazco.org>2013-01-29 00:52:02 +0000
commitc5dc37e51421a61fc1ed28c2762607b0843e10eb (patch)
treebe0bbdfe08e0f92f41ad775d2ee6f951cbe0389b
parent7ade4aeb90d841655b5f8accbab8e0c91a88ecc6 (diff)
downloadillumos-joyent-c5dc37e51421a61fc1ed28c2762607b0843e10eb.tar.gz
OS-1836 passwd command truncates usernames to 8 chars by default (overflow)
-rw-r--r--usr/src/lib/libc/port/gen/getlogin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr/src/lib/libc/port/gen/getlogin.c b/usr/src/lib/libc/port/gen/getlogin.c
index db86ceef4c..e96d294fd0 100644
--- a/usr/src/lib/libc/port/gen/getlogin.c
+++ b/usr/src/lib/libc/port/gen/getlogin.c
@@ -77,7 +77,8 @@ generic_getlogin(char *answer, int namelen, boolean_t truncate)
(void) close(uf);
if (ubuf.ut_user[0] == '\0')
return (-1);
- if (strlen(ubuf.ut_user) >= namelen && !truncate) {
+ if (strnlen(ubuf.ut_user, sizeof (ubuf.ut_user)) >= namelen &&
+ !truncate) {
errno = ERANGE;
return (-1);
}