]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ntlm: silence ubsan warning about copying from null target_info pointer.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 12 Nov 2022 00:42:18 +0000 (16:42 -0800)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 13 Nov 2022 21:42:01 +0000 (22:42 +0100)
runtime error: null pointer passed as argument 2, which is declared to
never be null

Closes #9898

lib/curl_ntlm_core.c

index 38e193c186a5b141c7897ff62521cee83a4d1b0f..461c009d28396505f39bc769a1f55c39d5b7c17d 100644 (file)
@@ -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);