From c455d17c09f797055ec52afc25e8735c72d00ca0 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Sat, 21 Jan 2012 14:43:07 +0100 Subject: [PATCH] qdev-property: Make bit property parsing stricter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By using strncasecmp, we allow for arbitrary characters after the "on"/"off" string. Fix this by switching to strcasecmp. Reviewed-by: Andreas Färber Reviewed-by: Markus Armbruster Signed-off-by: Jan Kiszka Signed-off-by: Stefan Hajnoczi --- hw/qdev-properties.c | 4 ++-- 1 file 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; -- GitLab