From d4ab672cf599e0d04d2c8943f0969f9cd77c1b0a Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 28 Mar 2016 07:20:08 +0200 Subject: [PATCH] ntdll: Fix off-by-one errors in __wine_set_signal_handler. Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- dlls/ntdll/signal_arm.c | 2 +- dlls/ntdll/signal_arm64.c | 2 +- dlls/ntdll/signal_powerpc.c | 2 +- dlls/ntdll/signal_x86_64.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c index 5ee9f453333..cb5f67db75b 100644 --- a/dlls/ntdll/signal_arm.c +++ b/dlls/ntdll/signal_arm.c @@ -860,7 +860,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) */ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { - if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; + if (sig >= sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; handlers[sig] = wsh; return 0; diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 3a41c8405cc..14c5260c148 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -732,7 +732,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) */ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { - if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; + if (sig >= sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; handlers[sig] = wsh; return 0; diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c index 886da863704..507490a5264 100644 --- a/dlls/ntdll/signal_powerpc.c +++ b/dlls/ntdll/signal_powerpc.c @@ -940,7 +940,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) */ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { - if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; + if (sig >= sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; handlers[sig] = wsh; return 0; diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 1e88df31437..a79fd6eb47d 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -2762,7 +2762,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext ) */ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { - if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; + if (sig >= sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; handlers[sig] = wsh; return 0;