Module Name: src
Committed By: christos
Date: Thu Sep 22 12:38:34 UTC 2011
Modified Files:
src/dist/dhcp/dst: prandom.c
Log Message:
check the result of malloc (Maksymilian Arciemowicz)
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/dist/dhcp/dst/prandom.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/dist/dhcp/dst/prandom.c
diff -u src/dist/dhcp/dst/prandom.c:1.6 src/dist/dhcp/dst/prandom.c:1.7
--- src/dist/dhcp/dst/prandom.c:1.6 Tue Jan 26 14:11:00 2010
+++ src/dist/dhcp/dst/prandom.c Thu Sep 22 08:38:33 2011
@@ -1,5 +1,5 @@
#ifndef LINT
-static const char rcsid[] = "$Header: /cvsroot/src/dist/dhcp/dst/prandom.c,v 1.6 2010/01/26 19:11:00 drochner Exp $";
+static const char rcsid[] = "$Header: /cvsroot/src/dist/dhcp/dst/prandom.c,v 1.7 2011/09/22 12:38:33 christos Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -26,6 +26,7 @@
#include <fcntl.h>
#include <time.h>
#include <dirent.h>
+#include <err.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -454,6 +455,8 @@
if (hash->step > 1) { /* if using subset of input data */
tmp_size = size / hash->step + 2;
abuf = tp = malloc(tmp_size);
+ if (tp == NULL)
+ err(1, "malloc");
tmp = tp;
for (cnt = 0, i = hash->curr; i < size; i += hash->step, cnt++)
*(tp++) = input[i];