Fixed buffer overflow in qemu networking

This commit is contained in:
Daniel P. Berrange 2007-03-20 16:50:42 +00:00
parent 4ffe066dd8
commit 07fb9d64b0
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,8 @@
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>
* src/virsh.c: add error messages for negative memory size as

View File

@ -1301,13 +1301,14 @@ int qemudBuildCommandLine(struct qemud_server *server,
} else {
int vlan = 0;
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",
net->mac[0], net->mac[1],
net->mac[2], net->mac[3],
net->mac[4], net->mac[5],
vlan);
if (snprintf(nic, sizeof(nic), "nic,macaddr=%02x:%02x:%02x:%02x:%02x:%02x,vlan=%d",
net->mac[0], net->mac[1],
net->mac[2], net->mac[3],
net->mac[4], net->mac[5],
vlan) >= sizeof(nic))
goto error;
if (!((*argv)[++n] = strdup("-net")))
goto no_memory;