diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | qemud/conf.c | 4 | ||||
-rw-r--r-- | src/virsh.c | 2 | ||||
-rw-r--r-- | src/xend_internal.c | 4 | ||||
-rw-r--r-- | src/xs_internal.c | 4 |
6 files changed, 12 insertions, 8 deletions
@@ -1,3 +1,8 @@ +Fri Mar 23 17:14:10 CET 2007 Daniel Veillard <veillard@redhat.com> + + * TODO qemud/conf.c src/virsh.c src/xend_internal.c src/xs_internal.c: + replaced all sprintf instances by snprintf ones + Fri Mar 23 09:12:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com> * src/xen_internal.c: Fix detection of host PAE capabilities, @@ -1,6 +1,5 @@ TODO: - libvirt_virDomainSetMemory should check memory is > 0 -- remove calls from sprintf and use snprintf - check how to better handle renaming of domains (xm rename and cache) - UUID lookup in hash.c diff --git a/qemud/conf.c b/qemud/conf.c index fb326c15f..5136001c5 100644 --- a/qemud/conf.c +++ b/qemud/conf.c @@ -1196,8 +1196,8 @@ int qemudBuildCommandLine(struct qemud_server *server, (vm->def->graphicsType == QEMUD_GRAPHICS_VNC ? 2 : (vm->def->graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)); /* graphics */ - sprintf(memory, "%d", vm->def->memory/1024); - sprintf(vcpus, "%d", vm->def->vcpus); + snprintf(memory, sizeof(memory), "%d", vm->def->memory/1024); + snprintf(vcpus, sizeof(vcpus), "%d", vm->def->vcpus); if (!(*argv = malloc(sizeof(char *) * (len+1)))) goto no_memory; diff --git a/src/virsh.c b/src/virsh.c index 18241cf4a..d342dc975 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -3282,7 +3282,7 @@ vshReadlineOptionsGenerator(const char *text, int state) continue; } res = vshMalloc(NULL, strlen(name) + 3); - sprintf(res, "--%s", name); + snprintf(res, strlen(name) + 3, "--%s", name); return res; } diff --git a/src/xend_internal.c b/src/xend_internal.c index a84dcaba5..3113992e0 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -799,7 +799,7 @@ urlencode(const char *string) switch (string[i]) { case ' ': case '\n': - sprintf(ptr, "%%%02x", string[i]); + snprintf(ptr, 4, "%%%02x", string[i]); ptr += 3; break; default: @@ -2670,7 +2670,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu, /* from bit map, build character string of mapped CPU numbers */ for (i = 0; i < maplen; i++) for (j = 0; j < 8; j++) if (cpumap[i] & (1 << j)) { - sprintf(buf, "%d,", (8 * i) + j); + snprintf(buf, sizeof(buf), "%d,", (8 * i) + j); strcat(mapstr, buf); } mapstr[strlen(mapstr) - 1] = ']'; diff --git a/src/xs_internal.c b/src/xs_internal.c index 367614f61..0602ef6c1 100644 --- a/src/xs_internal.c +++ b/src/xs_internal.c @@ -818,12 +818,12 @@ xenStoreDomainGetNetworkID(virConnectPtr conn, int id, const char *mac) { if (maclen <= 0) return (NULL); - sprintf(dir, "/local/domain/0/backend/vif/%d", id); + snprintf(dir, sizeof(dir), "/local/domain/0/backend/vif/%d", id); list = xs_directory(conn->xshandle, 0, dir, &num); if (list == NULL) return(NULL); for (i = 0; i < num; i++) { - sprintf(path, "%s/%s/%s", dir, list[i], "mac"); + snprintf(path, sizeof(path), "%s/%s/%s", dir, list[i], "mac"); val = xs_read(conn->xshandle, 0, path, &len); if (val == NULL) break; |