qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Jan Kiszka <jan.kiszka@web.de>,
	qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 2/6] qdev-property: Make bit property parsing stricter
Date: Fri, 27 Jan 2012 07:27:58 +0000	[thread overview]
Message-ID: <1327649282-12431-3-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1327649282-12431-1-git-send-email-stefanha@linux.vnet.ibm.com>

From: Jan Kiszka <jan.kiszka@web.de>

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>
---
 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.8.3

  parent reply	other threads:[~2012-01-27  7:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27  7:27 [Qemu-devel] [PULL 0/6] Trivial patches for 20 to 27 January 2012 Stefan Hajnoczi
2012-01-27  7:27 ` [Qemu-devel] [PATCH 1/6] remove #if 0 code for timers Stefan Hajnoczi
2012-01-27  7:27 ` Stefan Hajnoczi [this message]
2012-01-27 10:09   ` [Qemu-devel] [PATCH 2/6] qdev-property: Make bit property parsing stricter Andreas Färber
2012-02-05  7:30     ` Stefan Hajnoczi
2012-01-27  7:27 ` [Qemu-devel] [PATCH 3/6] e1000: Preserve link state across device reset Stefan Hajnoczi
2012-01-27  7:28 ` [Qemu-devel] [PATCH 4/6] pcnet: " Stefan Hajnoczi
2012-01-27  7:28 ` [Qemu-devel] [PATCH 5/6] ./configure: export xfs config via --{enable, disable}-xfsctl Stefan Hajnoczi
2012-01-27 17:33 ` [Qemu-devel] [PULL 0/6] Trivial patches for 20 to 27 January 2012 Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327649282-12431-3-git-send-email-stefanha@linux.vnet.ibm.com \
    --to=stefanha@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).