mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
linux-user: fix QEMU_STRACE=1 segfault
While debugging some issues with QEMU_STRACE I stumbled over segmentation faults that were pretty reproducible. Turns out we tried to treat a normal return value as errno, resulting in an access over array boundaries for the resolution. Fix this by allowing failure to resolve invalid errnos into strings. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
parent
583359a689
commit
962b289ef3
2 changed files with 17 additions and 4 deletions
|
@ -731,6 +731,9 @@ static inline int is_error(abi_long ret)
|
|||
|
||||
char *target_strerror(int err)
|
||||
{
|
||||
if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) {
|
||||
return NULL;
|
||||
}
|
||||
return strerror(target_to_host_errno(err));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue