On (Fri) 08 May 2015 [09:19:02], Dan Carpenter wrote:
> My static checker complains that this sprintf() can overflow.
>
> vdev->index is selected by ida_simple_get() in register_virtio_device()
> so my reading of the code is that this overflow is theoretically
> possible. The max value of "id" is configurable and I'm not sure what
> typical values are.
vdev->index is per-device, and starts with 0 for the first attached
virtio-serial-pci device. So to overflow, a lot of devices have to be
attached, which isn't possible with current qemu. 16 bytes was
already overkill..
> Anyway, it's simple enough to make the buffer larger and I changed it to
> snprintf() as well.
Any reason to choose 28? I think 16 is enough.
The snprintf change is fine, though.
Amit
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization