linux-user: fix signal number range check
PATCH 1/1 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 <[email protected]>
--- linux-user/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/signal.c +2 -2
@@ -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]; }
Signature · 7 lines
1.8.3.1 -- Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 4 lines · Andreas Schwab
When translating between host and target signal numbers keep negative numbers unchanged, avoiding access beyond array bounds.
Signed-off-by Andreas Schwab <[email protected]>
Reviewed-by Peter Maydell <[email protected]>
-- PMM