diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 727d76e89d..a816c3a4f9 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -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: