[PATCH v2 7/8] esx: Use memcpy() in esxVI_CURL_Debug()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/esx/esx_vi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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:
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux