mirror of https://gitee.com/openkylin/qemu.git
qdev-property: Make bit property parsing stricter
By using strncasecmp, we allow for arbitrary characters after the "on"/"off" string. Fix this by switching to strcasecmp. Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
This commit is contained in:
parent
36945d95d2
commit
c455d17c09
|
@ -40,9 +40,9 @@ static void qdev_prop_cpy(DeviceState *dev, Property *props, void *src)
|
|||
/* Bit */
|
||||
static int parse_bit(DeviceState *dev, Property *prop, const char *str)
|
||||
{
|
||||
if (!strncasecmp(str, "on", 2))
|
||||
if (!strcasecmp(str, "on"))
|
||||
bit_prop_set(dev, prop, true);
|
||||
else if (!strncasecmp(str, "off", 3))
|
||||
else if (!strcasecmp(str, "off"))
|
||||
bit_prop_set(dev, prop, false);
|
||||
else
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue