also check the return value of an adjacent malloc() call.
ok jsing@
-/* $OpenBSD: apps.c,v 1.23 2015/01/01 14:28:00 jsing Exp $ */
+/* $OpenBSD: apps.c,v 1.24 2015/01/03 03:03:39 lteo Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
if (arg->count == 0) {
arg->count = 20;
arg->data = reallocarray(NULL, arg->count, sizeof(char *));
+ if (arg->data == NULL)
+ return 0;
}
for (i = 0; i < arg->count; i++)
arg->data[i] = NULL;
-/* $OpenBSD: rsautl.c,v 1.3 2014/08/28 14:25:48 jsing Exp $ */
+/* $OpenBSD: rsautl.c,v 1.4 2015/01/03 03:03:39 lteo Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
keysize = RSA_size(rsa);
rsa_in = reallocarray(NULL, keysize, 2);
+ if (rsa_in == NULL) {
+ BIO_printf(bio_err, "Error allocating memory for input data\n");
+ exit(1);
+ }
rsa_out = malloc(keysize);
+ if (rsa_out == NULL) {
+ BIO_printf(bio_err, "Error allocating memory for output data\n");
+ exit(1);
+ }
/* Read the input data */
rsa_inlen = BIO_read(in, rsa_in, keysize * 2);
-/* $OpenBSD: speed.c,v 1.3 2015/01/02 04:00:21 lteo Exp $ */
+/* $OpenBSD: speed.c,v 1.4 2015/01/03 03:03:39 lteo Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
const char *errstr = NULL;
fds = reallocarray(NULL, multi, sizeof *fds);
+ if (fds == NULL) {
+ fprintf(stderr, "reallocarray failure\n");
+ exit(1);
+ }
for (n = 0; n < multi; ++n) {
if (pipe(fd) == -1) {
fprintf(stderr, "pipe failure\n");