summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2001-06-18 16:09:24 +0000
committerdwmalone <dwmalone@FreeBSD.org>2001-06-18 16:09:24 +0000
commit3f41cb9d845f29f7cc5902a58e6b42b85886a16a (patch)
treeeccc608297b02a4c0ab2e62ce1747d9b8c3967c7 /lib
parent2012259e87bb2855f986d40741d15b6d6371986d (diff)
downloadFreeBSD-src-3f41cb9d845f29f7cc5902a58e6b42b85886a16a.zip
FreeBSD-src-3f41cb9d845f29f7cc5902a58e6b42b85886a16a.tar.gz
If the username we are trying to look up in the db files won't fit into
the buffer then act like it doesn't exist. The buffer is always big enough for any valid username. PR: 27860 Reviewed by: nectar
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getpwent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index f3bccd5..ae384ba 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -386,7 +386,9 @@ _local_getpw(rv, cb_data, ap)
case _PW_KEYBYNAME:
name = va_arg(ap, const char *);
len = strlen(name);
- memmove(bf + 1, name, (size_t)MIN(len, MAXLOGNAME));
+ if (len > sizeof(bf) - 1)
+ return NS_NOTFOUND;
+ memmove(bf + 1, name, len);
key.size = len + 1;
break;
case _PW_KEYBYUID:
OpenPOWER on IntegriCloud