mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-23 22:52:23 +03:00
fix buffer overrun in getgrent code when there are no group members
This commit is contained in:
parent
f9ed11f3e1
commit
fb62ae74d0
@ -37,10 +37,14 @@ struct group *__getgrent_a(FILE *f, struct group *gr, char **line, size_t *size,
|
||||
*line = 0;
|
||||
return 0;
|
||||
}
|
||||
mem[0][0] = mems;
|
||||
for (s=mems, i=0; *s; s++)
|
||||
if (*s==',') *s++ = 0, mem[0][++i] = s;
|
||||
mem[0][++i] = 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user