Project

General

Profile

Bug #3248 » 0002-kill-1-Don-t-kill-pid-1-on-overflow-from-strtol-3.patch

piecuch, 09/16/2020 11:16 AM

View differences:

bin/kill/kill.c
int
main(int argc, char **argv)
{
int errors, numsig;
long pidl;
pid_t pid;
int errors, numsig, ret;
char *ep;
if (argc < 2)
......
else
#endif
{
pid = (pid_t)strtol(*argv, &ep, 10);
if (**argv == '\0' || *ep != '\0')
pidl = strtol(*argv, &ep, 10);
/* check for overflow of pid_t. */
pid = (pid_t)pidl;
if (!**argv || *ep || pid != pidl)
errx(2, "illegal process id: %s", *argv);
}
if (kill(pid, numsig) == -1) {
(1-1/10)