[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Replace strcmp() by strncmp()
From: |
Pavel Vasilyev |
Subject: |
[Qemu-devel] [PATCH] Replace strcmp() by strncmp() |
Date: |
Tue, 27 Jan 2009 03:34:05 +0300 |
User-agent: |
KMail/1.9.10 |
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;
signature.asc
Description: This is a digitally signed message part.