summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1992-11-16 19:50:37 +0000
committerRoland McGrath <roland@gnu.org>1992-11-16 19:50:37 +0000
commit5de44a379d92e1d046ef640deb8ea60ffa9855cc (patch)
tree526f292f3472e0cbfd130ee114b0185806fda987 /misc
parentc5f4042cc06495b7220d4f79e92c98daf57220b9 (diff)
entered into RCS
Diffstat (limited to 'misc')
-rw-r--r--misc/getusershell.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/getusershell.c b/misc/getusershell.c
index 9c7047a4c3..6cd9b041e8 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -110,7 +110,7 @@ initshells()
(void)fclose(fp);
return(okshells);
}
- if ((strings = malloc((unsigned)statb.st_size)) == NULL) {
+ if ((strings = malloc((unsigned)statb.st_size + 1)) == NULL) {
(void)fclose(fp);
return(okshells);
}
@@ -123,7 +123,7 @@ initshells()
}
sp = shells;
cp = strings;
- while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) {
+ while (fgets(cp, strings + statb.st_size - cp, fp) != NULL) {
while (*cp != '#' && *cp != '/' && *cp != '\0')
cp++;
if (*cp == '#' || *cp == '\0')