From owner-freebsd-bugs Sun Jul 7 1:30:12 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F10F137B401 for ; Sun, 7 Jul 2002 01:30:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 53D6C43E42 for ; Sun, 7 Jul 2002 01:30:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g678U5JU069709 for ; Sun, 7 Jul 2002 01:30:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g678U5Yv069708; Sun, 7 Jul 2002 01:30:05 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1837F37B400 for ; Sun, 7 Jul 2002 01:26:03 -0700 (PDT) Received: from core.zp.ua (core.zp.ua [193.108.112.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E6FB43E52 for ; Sun, 7 Jul 2002 01:26:00 -0700 (PDT) (envelope-from oleg@core.zp.ua) Received: from core.zp.ua (oleg@localhost [127.0.0.1]) by core.zp.ua with ESMTP id g678PuUY041339 for ; Sun, 7 Jul 2002 11:25:56 +0300 (EEST) (envelope-from oleg@core.zp.ua) Received: (from oleg@localhost) by core.zp.ua id g678PuYG041338; Sun, 7 Jul 2002 11:25:56 +0300 (EEST) Message-Id: <200207070825.g678PuYG041338@core.zp.ua> Date: Sun, 7 Jul 2002 11:25:56 +0300 (EEST) From: "Oleg V. Naumann" Reply-To: "Oleg V. Naumann" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/40282: /bin/kill has bad error checking for command line parameters Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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