* TODO qemud/conf.c src/virsh.c src/xend_internal.c src/xs_internal.c:

replaced all sprintf instances by snprintf ones
Daniel
This commit is contained in:
Daniel Veillard 2007-03-23 16:15:07 +00:00
parent ba83eae40f
commit 80fb564b0d
6 changed files with 12 additions and 8 deletions

View File

@ -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
TODO
View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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] = ']';

View File

@ -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;