From 9471b0b36da94b507196c4db9884ec48e1b3a41b Mon Sep 17 00:00:00 2001 From: Michael Kwasigroch Date: Thu, 26 Nov 2015 22:30:43 +0100 Subject: [PATCH] Fix SEGV of kill -l 0 * kill.cc (strsigno): Don't call sys_sigabbrev for signal 0. (listsig): Don't call strsigno for signal 0. Signed-off-by: Corinna Vinschen --- winsup/utils/ChangeLog | 5 +++++ winsup/utils/kill.cc | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 70c03335a..de00ef71b 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,8 @@ +2015-11-26 Michael Kwasigroch + + * kill.cc (strsigno): Don't call sys_sigabbrev for signal 0. + (listsig): Don't call strsigno for signal 0. + 2015-11-18 Corinna Vinschen * setfacl.c (action_t): Rename DeleteAll to DeleteExt. Add diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc index edabff321..2a7d8f6ec 100644 --- a/winsup/utils/kill.cc +++ b/winsup/utils/kill.cc @@ -1,7 +1,7 @@ /* kill.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, - 2009, 2011 Red Hat, Inc. + 2009, 2011, 2015 Red Hat, Inc. This file is part of Cygwin. @@ -70,7 +70,7 @@ print_version () static const char * strsigno (int signo) { - if (signo >= 0 && signo < NSIG) + if (signo > 0 && signo < NSIG) return sys_sigabbrev[signo]; static char buf[sizeof ("Unknown signal") + 32]; sprintf (buf, "Unknown signal %d", signo); @@ -121,7 +121,7 @@ listsig (const char *in_sig) { sig = getsig (in_sig); test_for_unknown_sig (sig, in_sig); - if (atoi (in_sig) == sig) + if (sig && atoi (in_sig) == sig) puts (strsigno (sig) + 3); else printf ("%d\n", sig);