+2010-02-03 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #11242]
+ * misc/getusershell.c (initshells): Allocate one more byte in input
+ buffer so that fgets doesn't loop undefinitely.
+
2010-02-02 Ulrich Drepper <drepper@redhat.com>
* stdlib/setenv.c (__add_to_environ): Don't use alloca if
}
if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3)
goto init_okshells;
- if ((strings = malloc(statb.st_size + 2)) == NULL)
+ flen = statb.st_size + 3;
+ if ((strings = malloc(flen)) == NULL)
goto init_okshells;
shells = malloc(statb.st_size / 3 * sizeof (char *));
if (shells == NULL) {
}
sp = shells;
cp = strings;
- flen = statb.st_size + 2;
while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) {
while (*cp != '#' && *cp != '/' && *cp != '\0')
cp++;