From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] pci-assign: Fix potential read beyond buffer on -EBUSY
Date: Fri, 21 Feb 2014 17:42:05 +0100 [thread overview]
Message-ID: <1393000925-8446-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1393000925-8446-1-git-send-email-armbru@redhat.com>
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>
---
hw/i386/kvm/pci-assign.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 9686801..a825871 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;
--
1.8.1.4
next prev parent reply other threads:[~2014-02-21 16:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 16:42 [Qemu-devel] [PATCH 0/2] Two buffer overruns in device assignment Markus Armbruster
2014-02-21 16:42 ` [Qemu-devel] [PATCH 1/2] vfio: Fix overrun after readlink() fills buffer completely Markus Armbruster
2014-02-21 16:47 ` Peter Maydell
2014-02-21 17:17 ` Alex Williamson
2014-02-24 14:04 ` Markus Armbruster
2014-02-21 16:42 ` Markus Armbruster [this message]
2014-02-21 16:51 ` [Qemu-devel] [PATCH 2/2] pci-assign: Fix potential read beyond buffer on -EBUSY Peter Maydell
2014-02-21 16:55 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393000925-8446-3-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).