aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-02-26 10:30:03 -0700
committerAlex Williamson <alex.williamson@redhat.com>2014-02-26 10:30:03 -0700
commit82d07945652f16078b172d2bd46659e8f5f30d8e (patch)
tree72077ca349fb9c721802132aa96d9480fea7333b
parent13665a2d2f675341e73618fcd7f9d36b6c68b509 (diff)
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>
-rw-r--r--hw/i386/kvm/pci-assign.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 968680104b..a825871d8a 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -743,6 +743,7 @@ static void assign_failed_examine(AssignedDevice *dev)
goto fail;
}
+ driver[r] = 0;
ns = strrchr(driver, '/');
if (!ns) {
goto fail;