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:
parent
c03e52786d
commit
990ea89ae9
@ -37,6 +37,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdint.h>
|
||||||
#ifdef WITH_SYSTEMD
|
#ifdef WITH_SYSTEMD
|
||||||
#include <systemd/sd-login.h>
|
#include <systemd/sd-login.h>
|
||||||
#endif
|
#endif
|
||||||
@ -1369,7 +1370,7 @@ PROCTAB* openproc(unsigned flags, ...) {
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
static int did_stat;
|
static int did_stat;
|
||||||
PROCTAB* PT = malloc(sizeof(PROCTAB));
|
PROCTAB* PT = calloc(1, sizeof(PROCTAB));
|
||||||
|
|
||||||
if (!PT)
|
if (!PT)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user