diff options
author | Roland McGrath <roland@gnu.org> | 1994-07-31 19:26:52 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1994-07-31 19:26:52 +0000 |
commit | 4419624bd5b2b6db341b7b2512654b5d0b635e1e (patch) | |
tree | 187ca2f3382aa691a1faffc256e5525756b832b4 /misc | |
parent | 5991fa4e62f2efab22819e8360a176ff8cfc3d58 (diff) |
(initshells): Reapply fix of 16 Nov 1992.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/getusershell.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/getusershell.c b/misc/getusershell.c index 2bcdaf78bd..6782c3efe9 100644 --- a/misc/getusershell.c +++ b/misc/getusershell.c @@ -108,7 +108,7 @@ initshells() (void)fclose(fp); return (okshells); } - if ((strings = malloc((u_int)statb.st_size)) == NULL) { + if ((strings = malloc((u_int)statb.st_size + 1)) == NULL) { (void)fclose(fp); return (okshells); } @@ -121,7 +121,7 @@ initshells() } sp = shells; cp = strings; - while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) { + while (fgets(cp, statb.st_size - (cp - strings), fp) != NULL) { while (*cp != '#' && *cp != '/' && *cp != '\0') cp++; if (*cp == '#' || *cp == '\0') |