about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-05-22 08:57:22 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-05-22 08:57:22 +0000
commitd64e62ef11fc9e37acd19d77d4927538ba755787 (patch)
treed35bf46c0059062778608e36265af52087e44c0a
parent338c70ff56d5cccff2d9502decef361350ceedf4 (diff)
downloadzsh-d64e62ef11fc9e37acd19d77d4927538ba755787.tar.gz
zsh-d64e62ef11fc9e37acd19d77d4927538ba755787.tar.xz
zsh-d64e62ef11fc9e37acd19d77d4927538ba755787.zip
Danek: 30485: trailing garbage after signal number not recognised in kill
-rw-r--r--ChangeLog7
-rw-r--r--Src/jobs.c11
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f642b47c3..9a66118b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-22  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Danek: 30485: Src/jobs.c: trailing garbage after signal
+	number not recognised in kill builtin.
+
 2012-05-21  Peter Stephenson  <pws@csr.com>
 
 	* c.f 30482 (Peter Jaros): Completion/Unix/Command/_tmux: typo
@@ -16313,5 +16318,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5656 $
+* $Revision: 1.5657 $
 *****************************************************
diff --git a/Src/jobs.c b/Src/jobs.c
index b17060175..c9c549e1e 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2164,10 +2164,15 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 
     /* check for, and interpret, a signal specifier */
     if (*argv && **argv == '-') {
-	if (idigit((*argv)[1]))
+	if (idigit((*argv)[1])) {
+	    char *endp;
 	    /* signal specified by number */
-	    sig = atoi(*argv + 1);
-	else if ((*argv)[1] != '-' || (*argv)[2]) {
+	    sig = zstrtol(*argv + 1, &endp, 10);
+	    if (*endp) {
+		zwarnnam(nam, "invalid signal number: %s", *argv);
+		return 1;
+	    }
+	} else if ((*argv)[1] != '-' || (*argv)[2]) {
 	    char *signame;
 
 	    /* with argument "-l" display the list of signal names */