From: Andrea Bolognani Date: Fri, 20 Jul 2018 07:50:37 +0000 (+0200) Subject: esx: Use memcpy() in esxVI_CURL_Debug() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=19136bbf10b6a49711e097cc23b0d25fa38b39f3;p=libvirt.git esx: Use memcpy() in esxVI_CURL_Debug() 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 --- 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: