From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHvww-0007sa-9s for qemu-devel@nongnu.org; Mon, 24 Feb 2014 08:52:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHvwp-0005f6-J4 for qemu-devel@nongnu.org; Mon, 24 Feb 2014 08:52:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHvwp-0005em-A2 for qemu-devel@nongnu.org; Mon, 24 Feb 2014 08:51:55 -0500 From: Markus Armbruster Date: Mon, 24 Feb 2014 14:51:49 +0100 Message-Id: <1393249909-11202-3-git-send-email-armbru@redhat.com> In-Reply-To: <1393249909-11202-1-git-send-email-armbru@redhat.com> References: <1393249909-11202-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/2] pci-assign: Fix potential read beyond buffer on -EBUSY List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, alex.williamson@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 Reviewed-by: Peter Maydell --- 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