From 7a16f4582da2b854a0adcba445bf6f8d750b2919 Mon Sep 17 00:00:00 2001 From: Brad Hubbard Date: Mon, 29 Jul 2013 10:13:12 +0200 Subject: [PATCH] fix uninitialised memory in merge_group_entries causes segfault in useradd by changing a call to malloc to a call to calloc --- ChangeLog | 4 ++++ lib/groupio.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bcb07fbe..e7115059 100644 --- 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 diff --git a/lib/groupio.c b/lib/groupio.c index 244307fc..5e89f5d7 100644 --- a/lib/groupio.c +++ b/lib/groupio.c @@ -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; -- 2.40.0