mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-21 10:50:24 +03:00
qemu: avoid null pointer dereference
This code has had problems historically. As originally written, in commit 6bcf2501 (Jun 08), it could call unlink on a random string, nuking an unrelated file. Then commit 182a80b9 (Sep 09), the code was rewritten to allocate tmp, with both a use-after-free bug and a chance to call unlink(NULL). Commit e206946 (Mar 11) fixed the use-after-free, but not the NULL dereference. Thanks to clang for catching this! * src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Don't call unlink on NULL.
This commit is contained in:
parent
4b4e8b57c2
commit
4d080ee403
@ -5355,7 +5355,8 @@ endjob:
|
||||
|
||||
cleanup:
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
unlink (tmp);
|
||||
if (tmp)
|
||||
unlink(tmp);
|
||||
VIR_FREE(tmp);
|
||||
if (vm)
|
||||
virDomainObjUnlock(vm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user