diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2012-01-21 14:43:07 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2012-01-27 05:50:16 +0000 |
commit | c455d17c09f797055ec52afc25e8735c72d00ca0 (patch) | |
tree | 775583134d9b3772bc1ec444607dde3183288ea3 | |
parent | 36945d95d249eda5536bf1683f0bee1a358c7642 (diff) |
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>
-rw-r--r-- | hw/qdev-properties.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 02f0dae0bc..ea3b2df35a 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -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; |