From 5f8351aea3b04e9692e0e256806eb968ad4d042b Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Fri, 11 Nov 2022 16:42:18 -0800 Subject: [PATCH] ntlm: silence ubsan warning about copying from null target_info pointer. runtime error: null pointer passed as argument 2, which is declared to never be null Closes #9898 --- lib/curl_ntlm_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index 38e193c186..461c009d28 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -658,7 +658,8 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, LONGQUARTET(tw.dwLowDateTime), LONGQUARTET(tw.dwHighDateTime)); memcpy(ptr + 32, challenge_client, 8); - memcpy(ptr + 44, ntlm->target_info, ntlm->target_info_len); + if(ntlm->target_info_len) + memcpy(ptr + 44, ntlm->target_info, ntlm->target_info_len); /* Concatenate the Type 2 challenge with the BLOB and do HMAC MD5 */ memcpy(ptr + 8, &ntlm->nonce[0], 8);