瀏覽代碼

net: Fix -net socket,listen (Jan Kiszka)

In case no symbolic name is provided when requesting VLAN connection via
listening TCP socket ('-net socket,listen=...'), qemu crashes. This
fixes the cause.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
aliguori 16 年之前
父節點
當前提交
700ece804f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net.c

+ 1 - 1
net.c

@@ -1468,7 +1468,7 @@ static int net_socket_listen_init(VLANState *vlan,
     }
     }
     s->vlan = vlan;
     s->vlan = vlan;
     s->model = strdup(model);
     s->model = strdup(model);
-    s->name = strdup(name);
+    s->name = name ? strdup(name) : NULL;
     s->fd = fd;
     s->fd = fd;
     qemu_set_fd_handler(fd, net_socket_accept, NULL, s);
     qemu_set_fd_handler(fd, net_socket_accept, NULL, s);
     return 0;
     return 0;