fix uninitialised memory in merge_group_entries causes segfault in useradd by

changing a call to malloc to a call to calloc
This commit is contained in:
Brad Hubbard 2013-07-29 10:13:12 +02:00 committed by bubulle
parent b10cba0e0a
commit 7a16f4582d
2 changed files with 5 additions and 1 deletions

View File

@ -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>

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