dslinux/user/sysutils kill.c

stsp stsp at user.in-berlin.de
Tue Oct 3 23:48:53 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/sysutils
In directory antilope:/tmp/cvs-serv8740

Modified Files:
	kill.c 
Log Message:
Validate arguments.

Patch by Daniele Forsi:

  If you don't give an argument to "kill" you get a data abort error.
  This happens if you run /etc/rc.d/network stop and udhcpc is not running
   
  kill `pidof udhcpc` 2> /dev/null
   
  How come that this source which is around since 1993 does not validate
  the arguments?
  


Index: kill.c
===================================================================
RCS file: /cvsroot/dslinux/dslinux/user/sysutils/kill.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- kill.c	31 Aug 2006 08:04:32 -0000	1.2
+++ kill.c	3 Oct 2006 21:48:51 -0000	1.3
@@ -39,7 +39,7 @@
 
 	sig = SIGTERM;
 
-	if (argv[1][0] == '-') {
+	if ((argc > 1) && argv[1][0] == '-') {
 		cp = &argv[1][1];
 		if (strcmp(cp, "HUP") == 0)
 			sig = SIGHUP;




More information about the dslinux-commit mailing list