Quellcode durchsuchen

linuxthreads/signals: do not restore handler for invalid signal

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>
Markos Chandras vor 12 Jahren
Ursprung
Commit
2b30ab7137
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      libpthread/linuxthreads/signals.c

+ 1 - 1
libpthread/linuxthreads/signals.c

@@ -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;
     }