提交 07fb9d64 编写于 作者: D Daniel P. Berrange

Fixed buffer overflow in qemu networking

上级 4ffe066d
Tue Mar 20 10:00:06 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/conf.c: Fixed buffer overflow in code building up
command line args for qemu networking
Tue Mar 20 16:40:06 CET 2007 Daniel Veillard <veillard@redhat.com> Tue Mar 20 16:40:06 CET 2007 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: add error messages for negative memory size as * src/virsh.c: add error messages for negative memory size as
......
...@@ -1301,13 +1301,14 @@ int qemudBuildCommandLine(struct qemud_server *server, ...@@ -1301,13 +1301,14 @@ int qemudBuildCommandLine(struct qemud_server *server,
} else { } else {
int vlan = 0; int vlan = 0;
while (net) { while (net) {
char nic[3+1+7+1+17+1]; char nic[100];
sprintf(nic, "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x,vlan=%d", if (snprintf(nic, sizeof(nic), "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x,vlan=%d",
net->mac[0], net->mac[1], net->mac[0], net->mac[1],
net->mac[2], net->mac[3], net->mac[2], net->mac[3],
net->mac[4], net->mac[5], net->mac[4], net->mac[5],
vlan); vlan) >= sizeof(nic))
goto error;
if (!((*argv)[++n] = strdup("-net"))) if (!((*argv)[++n] = strdup("-net")))
goto no_memory; goto no_memory;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册