Don't rely on unchecked arithmetic. Index: options.c =================================================================== RCS file: /cvs/src/bin/pax/options.c,v retrieving revision 1.84 diff -u -p -r1.84 options.c --- options.c 6 Feb 2014 20:51:55 -0000 1.84 +++ options.c 6 May 2014 20:56:22 -0000 @@ -779,11 +779,9 @@ tar_options(int argc, char **argv) size_t n = nincfiles + 3; struct incfile *p; - p = realloc(incfiles, - sizeof(*incfiles) * n); + p = reallocarray(incfiles, n, + sizeof(*incfiles)); if (p == NULL) { - free(incfiles); - incfiles = NULL; paxwarn(0, "Unable to allocate space " "for option list"); exit(1); Index: tables.c =================================================================== RCS file: /cvs/src/bin/pax/tables.c,v retrieving revision 1.30 diff -u -p -r1.30 tables.c --- tables.c 8 Jan 2014 06:43:34 -0000 1.30 +++ tables.c 6 May 2014 20:57:51 -0000 @@ -1131,7 +1131,7 @@ add_dir(char *name, struct stat *psb, in name = rp; } if (dircnt == dirsize) { - dblk = realloc(dirp, 2 * dirsize * sizeof(DIRDATA)); + dblk = reallocarray(dirp, dirsize, 2 * sizeof(DIRDATA)); if (dblk == NULL) { paxwarn(1, "Unable to store mode and times for created" " directory: %s", name);