qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Vasilyev <pavel@pavlinux.ru>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Replace strcmp() by strncmp()
Date: Tue, 27 Jan 2009 03:34:05 +0300	[thread overview]
Message-ID: <200901270334.14108.pavel@pavlinux.ru> (raw)
In-Reply-To: <200901270313.26331.pavel@pavlinux.ru>

[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]

Possible SIGSEGV 

Index: net.c
===================================================================
--- net.c       (revision 6463)
+++ net.c       (working copy)
@@ -1568,7 +1586,7 @@
     if (get_param_value(buf, sizeof(buf), "name", p)) {
         name = strdup(buf);
     }
-    if (!strcmp(device, "nic")) {
+    if (!strncmp(device, "nic", 3)) {
         NICInfo *nd;
         uint8_t *macaddr;

@@ -1601,13 +1630,13 @@
         vlan->nb_guest_devs++;
         ret = 0;
     } else
-    if (!strcmp(device, "none")) {
+    if (!strncmp(device, "none", 4)) {
         /* does nothing. It is needed to signal that no network cards
            are wanted */
         ret = 0;
     } else
 #ifdef CONFIG_SLIRP
-    if (!strcmp(device, "user")) {
+    if (!strncmp(device, "user", 4)) {
         if (get_param_value(buf, sizeof(buf), "hostname", p)) {
             pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf);
         }
@@ -1622,7 +1651,7 @@
     } else
 #endif
 #ifdef _WIN32
-    if (!strcmp(device, "tap")) {
+    if (!strncmp(device, "tap", 3)) {
         char ifname[64];
         if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
             fprintf(stderr, "tap: no interface name\n");
@@ -1633,7 +1662,7 @@
     } else
 #elif defined (_AIX)
 #else
-    if (!strcmp(device, "tap")) {
+    if (!strncmp(device, "tap", 3)) {
         char ifname[64];
         char setup_script[1024], down_script[1024];
         int fd;



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

  reply	other threads:[~2009-01-27  0:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27  0:13 [Qemu-devel] [PATCH] Random MAC address option Pavel Vasilyev
2009-01-27  0:34 ` Pavel Vasilyev [this message]
2009-01-27  9:28   ` [Qemu-devel] Re: [PATCH] Replace strcmp() by strncmp() Jan Kiszka
2009-01-27 20:49     ` Pavel Vasilyev
2009-01-27 21:20     ` Pavel Vasilyev
2009-01-27  0:57 ` [Qemu-devel] [PATCH] Random MAC address option malc
2009-01-27 10:05 ` Kevin Wolf
2009-01-27 10:15 ` Riku Voipio
2009-01-27 10:25   ` Daniel P. Berrange
2009-01-27 14:28     ` Ian Jackson
2009-01-27 20:51   ` Pavel Vasilyev
2009-01-27 16:33 ` Paul Brook
2009-01-27 16:47   ` 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=200901270334.14108.pavel@pavlinux.ru \
    --to=pavel@pavlinux.ru \
    --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).