778c4c2
diff -up shadow-4.1.5.1/lib/groupio.c.merge-group shadow-4.1.5.1/lib/groupio.c
778c4c2
--- shadow-4.1.5.1/lib/groupio.c.merge-group	2011-02-16 21:32:24.000000000 +0100
778c4c2
+++ shadow-4.1.5.1/lib/groupio.c	2013-01-29 13:56:43.049275513 +0100
778c4c2
@@ -330,12 +330,12 @@ static /*@null@*/struct commonio_entry *
778c4c2
 
778c4c2
 	/* Concatenate the 2 lines */
778c4c2
 	new_line_len = strlen (gr1->line) + strlen (gr2->line) +1;
778c4c2
-	new_line = (char *)malloc ((new_line_len + 1) * sizeof(char*));
778c4c2
+	new_line = (char *)malloc (new_line_len + 1);
778c4c2
 	if (NULL == new_line) {
778c4c2
 		errno = ENOMEM;
778c4c2
 		return NULL;
778c4c2
 	}
778c4c2
-	snprintf(new_line, new_line_len, "%s\n%s", gr1->line, gr2->line);
778c4c2
+	snprintf(new_line, new_line_len + 1, "%s\n%s", gr1->line, gr2->line);
778c4c2
 	new_line[new_line_len] = '\0';
778c4c2
 
778c4c2
 	/* Concatenate the 2 list of members */
778c4c2
@@ -353,7 +353,7 @@ static /*@null@*/struct commonio_entry *
778c4c2
 			members++;
778c4c2
 		}
778c4c2
 	}
778c4c2
-	new_members = (char **)malloc ( (members+1) * sizeof(char*) );
778c4c2
+	new_members = (char **)calloc (members+1, sizeof(char*));
778c4c2
 	if (NULL == new_members) {
778c4c2
 		free (new_line);
778c4c2
 		errno = ENOMEM;