pmap: Prevent integer overflow in main().
Unlikely to ever happen, but just in case.
This commit is contained in:
parent
db2f011895
commit
c6e427d22e
3
pmap.c
3
pmap.c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user