[Bug 7274] New: Segmentation fault in putgrent when calling groupadd

bugzilla at busybox.net bugzilla at busybox.net
Wed Jul 23 08:43:34 UTC 2014


https://bugs.busybox.net/show_bug.cgi?id=7274

           Summary: Segmentation fault in putgrent when calling groupadd
           Product: uClibc
           Version: 0.9.34
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: major
          Priority: P5
         Component: Other
        AssignedTo: unassigned at uclibc.org
        ReportedBy: mykola.tryshnivskyy at globallogic.com
                CC: uclibc-cvs at uclibc.org
   Estimated Hours: 0.0


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;
                     }

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list