fix buffer overrun in getgrent code when there are no group members

This commit is contained in:
Rich Felker 2011-06-30 08:11:06 -04:00
parent f9ed11f3e1
commit fb62ae74d0

View File

@ -37,10 +37,14 @@ struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size,
*line = 0;
return 0;
}
if (*mems) {
mem[0][0] = mems;
for (s=mems, i=0; *s; s++)
if (*s==',') *s++ = 0, mem[0][++i] = s;
mem[0][++i] = 0;
} else {
mem[0][0] = 0;
}
gr->gr_mem = *mem;
return gr;
}