Skip to content

Commit

Permalink
linuxthreads/signals: do not restore handler for invalid signal
Browse files Browse the repository at this point in the history
Invalid signals have no handlers so when trying to restore the old
handler to a bad signal a SIGSEGV occurs. This is because the library
tries to store the old handler to an invalid memory area where it things
the bad signal lives.

URL: https://bugs.busybox.net/show_bug.cgi?id=4640
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
  • Loading branch information
Markos Chandras authored and vapier committed Jan 15, 2012
1 parent a899b90 commit 2b30ab7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libpthread/linuxthreads/signals.c
Expand Up @@ -113,7 +113,7 @@ int __pthread_sigaction(int sig, const struct sigaction * act,
newactp = NULL;
if (__libc_sigaction(sig, newactp, oact) == -1)
{
if (act)
if (act && (sig > 0 && sig < NSIG))
__sighandler[sig].old = (arch_sighandler_t) old;
return -1;
}
Expand Down

0 comments on commit 2b30ab7

Please sign in to comment.