mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 11:23:43 +08:00
linux-user: fix signal number range check
When translating between host and target signal numbers keep negative numbers unchanged, avoiding access beyond array bounds. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 878v2b8sek.fsf@igel.home
This commit is contained in:
parent
7ff7b66618
commit
167c50d8f9
@ -102,14 +102,14 @@ static inline int sas_ss_flags(unsigned long sp)
|
||||
|
||||
int host_to_target_signal(int sig)
|
||||
{
|
||||
if (sig >= _NSIG)
|
||||
if (sig < 0 || sig >= _NSIG)
|
||||
return sig;
|
||||
return host_to_target_signal_table[sig];
|
||||
}
|
||||
|
||||
int target_to_host_signal(int sig)
|
||||
{
|
||||
if (sig >= _NSIG)
|
||||
if (sig < 0 || sig >= _NSIG)
|
||||
return sig;
|
||||
return target_to_host_signal_table[sig];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user