| Summary: | Segmentation fault in putgrent when calling groupadd | ||
|---|---|---|---|
| Product: | uClibc | Reporter: | Mykola <mykola.tryshnivskyy> |
| Component: | Other | Assignee: | unassigned |
| Status: | NEW --- | ||
| Severity: | major | CC: | uclibc-cvs |
| Priority: | P5 | ||
| Version: | 0.9.34 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Other | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | Proposed patch | ||
Created attachment 5516 [details]
Proposed patch
|
In release mode calling of 'groupadd -o -g 11 cdrom' caught segmentation fault in putgrent function, /libc/pwd_grp/pwd_grp.c, line 806 if (!*m) { if (__fputc_unlocked('\n', f) >= 0) { rv = 0; } break; } The reason is in null value of 'm' pointer. Proposed fix: diff --git a/libc/pwd_grp/pwd_grp.c b/libc/pwd_grp/pwd_grp.c index 0e7c7f7..2361b9b 100644 --- a/libc/pwd_grp/pwd_grp.c +++ b/libc/pwd_grp/pwd_grp.c @@ -803,7 +803,7 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) m = p->gr_mem; do { - if (!*m) { + if (!m || !*m) { if (__fputc_unlocked('\n', f) >= 0) { rv = 0; }