+ char *cmd; + char *reply; + /* XXX QEMU only supports a single CDROM for now */+ /*cmd = malloc(strlen("change ") + strlen(olddisk->dst) + 1 + strlen(newdisk->src) + 2);*/ + cmd = malloc(strlen("change ") + strlen("cdrom") + 1 + strlen(newdisk->src) + 2);
+ if (!cmd) {+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_MEMORY, "monitor command");
+ return -1; + } + strcpy(cmd, "change "); + /* XXX QEMU only supports a single CDROM for now */ + /*strcat(cmd, olddisk->dst);*/ + strcat(cmd, "cdrom"); + strcat(cmd, " "); + strcat(cmd, newdisk->src); + strcat(cmd, "\n");Much as it irritates me to say it, a fixed-size buffer and snprintf might be preferable here ...
Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list