On Sun, May 04, 2014 at 03:50:06PM -0400, Jean-Philippe Ouellet wrote: > On Sun, May 04, 2014 at 12:17:16PM -0600, Theo de Raadt wrote: > > We are going to completely ignore diffs which change multiple idioms > > at once. > > Okay. > > > That is how mistakes get made. > > Yep, more true than I realized. > > > Here's a simpler one: > [...] > Index: speed.c > =================================================================== > RCS file: /cvs/src/lib/libssl/src/apps/speed.c,v > retrieving revision 1.38 > diff -u -p -r1.38 speed.c > --- speed.c 2 May 2014 17:06:46 -0000 1.38 > +++ speed.c 4 May 2014 19:36:00 -0000 > @@ -2178,7 +2178,7 @@ do_multi(int multi) > int *fds; > static char sep[] = ":"; > > - fds = malloc(multi * sizeof *fds); > + fds = reallocarray(NULL, multi, sizeof(int));
how about a check for return value here? similar to other malloc -> reallocarray changes. --patrick > for (n = 0; n < multi; ++n) { > if (pipe(fd) == -1) { > fprintf(stderr, "pipe failure\n"); > Index: srp.c > =================================================================== > RCS file: /cvs/src/lib/libssl/src/apps/srp.c,v > retrieving revision 1.10 > diff -u -p -r1.10 srp.c > --- srp.c 24 Apr 2014 12:22:22 -0000 1.10 > +++ srp.c 4 May 2014 19:36:00 -0000 > @@ -176,7 +176,8 @@ update_index(CA_DB * db, BIO * bio, char > char **irow; > int i; > > - if ((irow = (char **) malloc(sizeof(char *) * (DB_NUMBER + 1))) == > NULL) { > + irow = reallocarray(NULL, DB_NUMBER + 1, sizeof(char *)); > + if (irow == NULL) > BIO_printf(bio_err, "Memory allocation failure\n"); > return 0; > } >