projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f9ed11f
)
fix buffer overrun in getgrent code when there are no group members
author
Rich Felker
<dalias@aerifal.cx>
Thu, 30 Jun 2011 12:11:06 +0000
(08:11 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 30 Jun 2011 12:11:06 +0000
(08:11 -0400)
src/passwd/getgrent_a.c
patch
|
blob
|
history
diff --git
a/src/passwd/getgrent_a.c
b/src/passwd/getgrent_a.c
index ccb51d523d8542efeffa3312de6bf97b8d62bb6e..7c63c57ba55f307f312906c72afe0fa41dfe277f 100644
(file)
--- a/
src/passwd/getgrent_a.c
+++ b/
src/passwd/getgrent_a.c
@@
-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;
}