From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 (+0000) Subject: pmap: Prevent integer overflow in main(). X-Git-Tag: v3.3.15~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6e427d22e587cce86c4105d6c831e62251ca079;p=procps-ng pmap: Prevent integer overflow in main(). Unlikely to ever happen, but just in case. --- 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) {