0080-proc/readproc.c: Harden openproc().

Replace xmalloc() with xcalloc().

---------------------------- adapted for newlib branch
. trade xcalloc() for calloc()
. thus we must account for potential ENOMEM

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Qualys Security Advisory 1970-01-01 00:00:00 +00:00 committed by Craig Small
parent c03e52786d
commit 990ea89ae9

View File

@ -37,6 +37,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <stdint.h>
#ifdef WITH_SYSTEMD
#include <systemd/sd-login.h>
#endif
@ -1369,7 +1370,7 @@ PROCTAB* openproc(unsigned flags, ...) {
va_list ap;
struct stat sbuf;
static int did_stat;
PROCTAB* PT = malloc(sizeof(PROCTAB));
PROCTAB* PT = calloc(1, sizeof(PROCTAB));
if (!PT)
return NULL;