]> granicus.if.org Git - shadow/commitdiff
fix uninitialised memory in merge_group_entries causes segfault in useradd by
authorBrad Hubbard <badone-guest@alioth.debian.org>
Mon, 29 Jul 2013 08:13:12 +0000 (10:13 +0200)
committerbubulle <bubulle@debian.org>
Mon, 29 Jul 2013 08:13:12 +0000 (10:13 +0200)
changing a call to malloc to a call to calloc

ChangeLog
lib/groupio.c

index bcb07fbe3dc9948464dbd5ceb8c30a4b187758e9..e711505989936aa35d90d602d49755f9b5b02e08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
         * lib/groupio.c: add newline char when two lines
           are concatenated
          Closes: alioth#313942
+       * lib/groupio.c: fix uninitialised memory in
+          merge_group_entries causes segfault in useradd by changing
+         a call to malloc to a call to calloc
+         Closes: alioth:#313940
 
 2013-07-28  Guido Trentalancia  <guido@trentalancia.com>
 
index 244307fcc72c87f14db2aaf85e36c0151c820929..5e89f5d7c3a41d1bfddd2be12eb303edab345a36 100644 (file)
@@ -353,7 +353,7 @@ static /*@null@*/struct commonio_entry *merge_group_entries (
                        members++;
                }
        }
-       new_members = (char **)malloc ( (members+1) * sizeof(char*) );
+       new_members = (char **)calloc ( (members+1), sizeof(char*) );
        if (NULL == new_members) {
                free (new_line);
                errno = ENOMEM;