kill: fix infinite loop when passed PIDs are not valid numbers
authorPere Orga <gotrunks@gmail.com>
Mon, 7 Mar 2011 15:22:17 +0000 (16:22 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 7 Mar 2011 16:00:25 +0000 (17:00 +0100)
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
procps/kill.c

index 39538016ecd0ba1836b98789e66278a3cd928cea..695d266c57e1612b89e5d5b5f8ae623fecdbe901 100644 (file)
@@ -219,6 +219,7 @@ int kill_main(int argc, char **argv)
                        pid = bb_strtoi(arg, &end, 10);
                        if (errno && (errno != EINVAL || *end != ' ')) {
                                bb_error_msg("invalid number '%s'", arg);
+                               *end = '\0';
                                errors++;
                        } else if (kill(pid, signo) != 0) {
                                bb_perror_msg("can't kill pid %d", (int)pid);