]> granicus.if.org Git - shadow/commitdiff
Fix Debian bug #675824
authorNicolas François <nicolas.francois@centraliens.net>
Tue, 6 Aug 2013 14:30:38 +0000 (16:30 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Tue, 6 Aug 2013 14:33:27 +0000 (16:33 +0200)
* lib/groupmem.c (__gr_dup): Support libc which define other
fields in struct group.
* lib/pwmem.c: Likewise for struct passwd.
* lib/shadowmem.c: Likewise for struct spwd.
* lib/sgroupio.c: Apply same logic, even if this structure is
defined internally.

ChangeLog
lib/groupmem.c
lib/pwmem.c
lib/sgroupio.c
lib/shadowmem.c

index 105099288afd04fe066b01453ab2fb59c1818a3b..4f64110a9917d2e44410ce541466a9b0825f1070 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-08-06  Nicolas François  <nicolas.francois@centraliens.net>
+
+       Fix Debian bug #675824
+       * lib/groupmem.c (__gr_dup): Support libc which define other
+       fields in struct group.
+       * lib/pwmem.c: Likewise for struct passwd.
+       * lib/shadowmem.c: Likewise for struct spwd.
+       * lib/sgroupio.c: Apply same logic, even if this structure is
+       defined internally.
+
 2013-08-05  Nicolas François  <nicolas.francois@centraliens.net>
 
        * lib/groupio.c: Revert change from 2013-07-29. The length of the
index f5b0532bda9b3ac524d581933465dfea226b2bae..f06ed3b2a7e7e79b71523e8d6e2531e75f38d3f8 100644 (file)
@@ -48,6 +48,8 @@
        if (NULL == gr) {
                return NULL;
        }
+       /* The libc might define other fields. They won't be copied. */
+       memset (gr, 0, sizeof *gr);
        gr->gr_gid = grent->gr_gid;
        gr->gr_name = strdup (grent->gr_name);
        if (NULL == gr->gr_name) {
index 5569191a858af62e2aec35326da55641e99b0b6f..9786d5b687d3d369a47d07833a81bcc2ae176a34 100644 (file)
@@ -48,6 +48,8 @@
        if (NULL == pw) {
                return NULL;
        }
+       /* The libc might define other fields. They won't be copied. */
+       memset (pw, 0, sizeof *pw);
        pw->pw_uid = pwent->pw_uid;
        pw->pw_gid = pwent->pw_gid;
        pw->pw_name = strdup (pwent->pw_name);
index 352383318af1a3633ec0ccd204fec6686c940500..7b51f015be6c45a118e4a86a3a1db39b3933448a 100644 (file)
@@ -51,6 +51,9 @@
        if (NULL == sg) {
                return NULL;
        }
+       /* Do the same as the other _dup function, even if we know the
+        * structure. */
+       memset (sg, 0, sizeof *sg);
        sg->sg_name = strdup (sgent->sg_name);
        if (NULL == sg->sg_name) {
                free (sg);
index 2dece3830afb4c044d990ab50f88c4eeb9477e3e..41dbc40ef1adb659ffc60056a4b731681e349404 100644 (file)
@@ -49,6 +49,8 @@
        if (NULL == sp) {
                return NULL;
        }
+       /* The libc might define other fields. They won't be copied. */
+       memset (sp, 0, sizeof *sp);
        sp->sp_lstchg = spent->sp_lstchg;
        sp->sp_min    = spent->sp_min;
        sp->sp_max    = spent->sp_max;