]> xenbits.xensource.com Git - libvirt.git/commitdiff
* TODO qemud/conf.c src/virsh.c src/xend_internal.c src/xs_internal.c:
authorDaniel Veillard <veillard@redhat.com>
Fri, 23 Mar 2007 16:15:07 +0000 (16:15 +0000)
committerDaniel Veillard <veillard@redhat.com>
Fri, 23 Mar 2007 16:15:07 +0000 (16:15 +0000)
  replaced all sprintf instances by snprintf ones
Daniel

ChangeLog
TODO
qemud/conf.c
src/virsh.c
src/xend_internal.c
src/xs_internal.c

index 86f204ec26431f919eddf8b0f91b9e64a89b0e2e..01c66da694a8b6e48e0eeea09b2dc5b1b0bc3b0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/TODO b/TODO
index 7d21fae43c66be0f6af4a630f9a892e9b060ce7f..b739d7f3271c7f3227a368e3ead1892cc75dfe8b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -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
index fb326c15fbb4c0caf1ac1139fffedff407cbe5f3..5136001c5c19150e8374a6c6332fc1cffc1e9e6d 100644 (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;
index 18241cf4a60439c1b789d45aeb61e9979e8894b9..d342dc97550d9976544706b05c8a710c7fe57919 100644 (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;
     }
 
index a84dcaba56cdde04dac879881a60b3712c978d2f..3113992e0de19d7113f5dca99860ba11846c95b8 100644 (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] = ']';
index 367614f61b3ada443a1e48319327f3c9e405d64a..0602ef6c1587c68d5fdae51815f65407b0d9b6c7 100644 (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;