diff options
author | 2014-01-17 20:51:54 +0000 | |
---|---|---|
committer | 2014-01-17 20:51:54 +0000 | |
commit | 74f2eca76a12567ff995c2d1b2adc88e48bef133 (patch) | |
tree | a02353dfe1d74099bc0858d7d1c161255734c7ca /lib/libc/gen/getusershell.c | |
parent | Sort the macro keys by their real-world frequency to reduce the average (diff) | |
download | wireguard-openbsd-74f2eca76a12567ff995c2d1b2adc88e48bef133.tar.xz wireguard-openbsd-74f2eca76a12567ff995c2d1b2adc88e48bef133.zip |
Fix off-by-one on specially crafted /etc/shells file.
ok gilles@, millert@
Diffstat (limited to 'lib/libc/gen/getusershell.c')
-rw-r--r-- | lib/libc/gen/getusershell.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/getusershell.c b/lib/libc/gen/getusershell.c index a46fd02571f..36af0ee2639 100644 --- a/lib/libc/gen/getusershell.c +++ b/lib/libc/gen/getusershell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getusershell.c,v 1.11 2013/11/24 23:51:29 deraadt Exp $ */ +/* $OpenBSD: getusershell.c,v 1.12 2014/01/17 20:51:54 tobias Exp $ */ /* * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. @@ -109,7 +109,7 @@ initshells(void) (void)fclose(fp); return (okshells); } - shells = calloc((size_t)(statb.st_size / 3), sizeof (char *)); + shells = calloc((size_t)(statb.st_size / 3 + 1), sizeof (char *)); if (shells == NULL) { (void)fclose(fp); free(strings); |