]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/core: rebase sysbus_get_fw_dev_path() to g_strdup_printf()
authorLaszlo Ersek <lersek@redhat.com>
Wed, 17 Jun 2015 12:45:03 +0000 (14:45 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 19 Jun 2015 10:17:49 +0000 (12:17 +0200)
commit5ba03e2dd785362026917e4cc8a1fd2c64e8e62c
treec85886ba98e633bc03eb7fa7e69a5561b78c0250
parent1717388645670336c48aa05d19b0acd07687a821
hw/core: rebase sysbus_get_fw_dev_path() to g_strdup_printf()

This is done mainly for improving readability, and in preparation for the
next patch, but Markus pointed out another bonus for the string being
returned:

"No arbitrary length limit. Before the patch, it's 39 characters, and the
code breaks catastrophically when qdev_fw_name() is longer: the second
snprintf() is called with its first argument pointing beyond path[], and
its second argument underflowing to a huge size."

Cc: qemu-stable@nongnu.org
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/core/sysbus.c