All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] qdev-property: Make bit property parsing stricter
@ 2012-01-21 13:43 ` Jan Kiszka
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Kiszka @ 2012-01-21 13:43 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Markus Armbruster

By using strncasecmp, we allow for arbitrary characters after the
"on"/"off" string. Fix this by switching to strcasecmp.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 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 02f0dae..ea3b2df 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;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-01-27  5:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-21 13:43 [Qemu-trivial] [PATCH] qdev-property: Make bit property parsing stricter Jan Kiszka
2012-01-21 13:43 ` [Qemu-devel] " Jan Kiszka
2012-01-21 16:36 ` [Qemu-trivial] " Andreas Färber
2012-01-21 16:36   ` Andreas Färber
2012-01-21 17:07   ` [Qemu-trivial] " Jan Kiszka
2012-01-21 17:07     ` Jan Kiszka
2012-01-24 12:05     ` [Qemu-trivial] " Markus Armbruster
2012-01-24 12:05       ` Markus Armbruster
2012-01-27  5:50 ` [Qemu-trivial] " Stefan Hajnoczi
2012-01-27  5:50   ` [Qemu-devel] " Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.