]> xenbits.xensource.com Git - libvirt.git/commitdiff
esx: Use memcpy() in esxVI_CURL_Debug()
authorAndrea Bolognani <abologna@redhat.com>
Fri, 20 Jul 2018 07:50:37 +0000 (09:50 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 23 Jul 2018 12:27:33 +0000 (14:27 +0200)
We're going to change virStrncpy() in a way that
requires the source string to be NULL-terminated, so
we'll no longer be able to use in this context.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
src/esx/esx_vi.c

index 727d76e89dd4bdebf8e0dc26d7de080023bae1b9..a816c3a4f98a4edbd3f188d665a790eb71619766 100644 (file)
@@ -185,10 +185,8 @@ esxVI_CURL_Debug(CURL *curl ATTRIBUTE_UNUSED, curl_infotype type,
     if (VIR_ALLOC_N(buffer, size + 1) < 0)
         return 0;
 
-    if (virStrncpy(buffer, info, size, size + 1) < 0) {
-        VIR_FREE(buffer);
-        return 0;
-    }
+    memcpy(buffer, info, size);
+    buffer[size] = '\0';
 
     switch (type) {
       case CURLINFO_TEXT: