diff --git a/pmap.c b/pmap.c index 77e363e0..6c1abc42 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")); if (procps_pids_new(&Pids_info, Pid_items, 4)) xerrx(EXIT_FAILURE, _("library failed pids statistics")); pidlist = xmalloc(sizeof(pid_t) * argc);