Commit d4ab672c authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

ntdll: Fix off-by-one errors in __wine_set_signal_handler.

parent e1f1a60f
...@@ -860,7 +860,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -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) 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; if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh; handlers[sig] = wsh;
return 0; return 0;
......
...@@ -732,7 +732,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -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) 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; if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh; handlers[sig] = wsh;
return 0; return 0;
......
...@@ -940,7 +940,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) ...@@ -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) 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; if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh; handlers[sig] = wsh;
return 0; return 0;
......
...@@ -2762,7 +2762,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext ) ...@@ -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) 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; if (handlers[sig] != NULL) return -2;
handlers[sig] = wsh; handlers[sig] = wsh;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment