Date: Sun, 7 Jul 2002 11:25:56 +0300 (EEST) From: "Oleg V. Naumann" <oleg@reis.zp.ua> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/40282: /bin/kill has bad error checking for command line parameters Message-ID: <200207070825.g678PuYG041338@core.zp.ua>
next in thread | raw e-mail | index | archive | help
>Number: 40282 >Category: bin >Synopsis: /bin/kill has bad error checking for command line parameters >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jul 07 01:30:04 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Oleg V. Naumann >Release: FreeBSD 4.6-STABLE i386 >Organization: ReIS Ltd. >Environment: System: FreeBSD core.zp.ua 4.6-STABLE FreeBSD 4.6-STABLE #1: Sat Jun 29 10:41:35 EEST 2002 root@core.zp.ua:/usr/obj/usr/src/sys/core i386 >Description: Some time ago I typed kill _HUP 1 under 'sh' shell after editing /etc/ttys Yes, this was a typo... Heh... oops... I'm in a single user mode without any warnings... This problem exist under sh/bash shells, because [t]csh has builtin 'kill' command, which seems doesn't have this problem: [root@core]~# set | grep shell shell /bin/tcsh [root@core]~# kill _HUP 1 kill: Arguments should be jobs or process id's. [root@core]~# which kill kill: shell built-in command. But sh/bash uses external /bin/kill: [root@core]~# sh # which kill /bin/kill # bash bash-2.05# which kill /bin/kill >How-To-Repeat: kill _HUP 1 under 'sh' or 'bash' shells (Please DO NOT on any production server!) >Fix: --- /usr/src/bin/kill/kill.c Wed Sep 26 09:54:28 2001 +++ kill.c Tue Jan 15 23:57:16 2002 @@ -125,7 +126,7 @@ if (argc == 0) usage(); - for (errors = 0; argc; argc--, argv++) { + for (errors = 0; (argc && (errors == 0)); argc--, argv++) { pid = strtol(*argv, &ep, 10); if (!**argv || *ep) { warnx("illegal process id: %s", *argv); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207070825.g678PuYG041338>