]> Git Repo - qemu.git/commitdiff
qdev-property: Make bit property parsing stricter
authorJan Kiszka <[email protected]>
Sat, 21 Jan 2012 13:43:07 +0000 (14:43 +0100)
committerStefan Hajnoczi <[email protected]>
Fri, 27 Jan 2012 05:50:16 +0000 (05:50 +0000)
By using strncasecmp, we allow for arbitrary characters after the
"on"/"off" string. Fix this by switching to strcasecmp.

Reviewed-by: Andreas Färber <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
hw/qdev-properties.c

index 02f0dae0bccaf351aa59366a096c3590059c900e..ea3b2df35aee3e716ef3c8684b813562805176d1 100644 (file)
@@ -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;
This page took 0.027836 seconds and 4 git commands to generate.