pci-assign: Fix potential read beyond buffer on -EBUSY
readlink() doesn't write a terminating null byte. assign_failed_examine() passes the unterminated string to strrchr(). Oops. Terminate it. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
13665a2d2f
commit
82d0794565
@ -743,6 +743,7 @@ static void assign_failed_examine(AssignedDevice *dev)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
driver[r] = 0;
|
||||||
ns = strrchr(driver, '/');
|
ns = strrchr(driver, '/');
|
||||||
if (!ns) {
|
if (!ns) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Loading…
Reference in New Issue
Block a user