]> git.proxmox.com Git - mirror_qemu.git/commit
vfio: Fix overrun after readlink() fills buffer completely
authorMarkus Armbruster <armbru@redhat.com>
Wed, 26 Feb 2014 17:28:36 +0000 (10:28 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 26 Feb 2014 17:28:36 +0000 (10:28 -0700)
commit13665a2d2f675341e73618fcd7f9d36b6c68b509
tree18b0db6388a85905cb0075c45e68c42331c48264
parentd5001cf787ad0514839a81d0f2e771e01e076e21
vfio: Fix overrun after readlink() fills buffer completely

readlink() returns the number of bytes written to the buffer, and it
doesn't write a terminating null byte.  vfio_init() writes it itself.
Overruns the buffer when readlink() filled it completely.

Fix by treating readlink() filling the buffer completely as error,
like we do in pci-assign.c's assign_failed_examine().

Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/misc/vfio.c