From c6e427d22e587cce86c4105d6c831e62251ca079 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] pmap: Prevent integer overflow in main(). Unlikely to ever happen, but just in case. --- pmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pmap.c b/pmap.c index 88f6c90b..ea1f46d7 100644 --- a/pmap.c +++ b/pmap.c @@ -30,6 +30,7 @@ #include #include #include +#include #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) {