pmap: Prevent integer overflow in main().

Unlikely to ever happen, but just in case.
This commit is contained in:
Qualys Security Advisory 1970-01-01 00:00:00 +00:00 committed by Craig Small
parent db2f011895
commit c6e427d22e

3
pmap.c
View File

@ -30,6 +30,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
#include <limits.h>
#include "c.h"
#include "fileutils.h"
@ -1136,6 +1137,8 @@ int main(int argc, char **argv)
}
if ((size_t)argc >= INT_MAX / sizeof(pid_t))
xerrx(EXIT_FAILURE, _("too many arguments"));
pidlist = xmalloc(sizeof(pid_t) * (argc+1));
while (*argv) {