From: Harry Sintonen Date: Tue, 1 Jun 2021 09:31:15 +0000 (+0200) Subject: Curl_ntlm_core_mk_nt_hash: fix OOM in error path X-Git-Tag: curl-7_78_0~233 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f1cd5004b0965884af0c1e5f268ae799e24f4f16;p=thirdparty%2Fcurl.git Curl_ntlm_core_mk_nt_hash: fix OOM in error path Closes #7164 --- diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index 89d4ec872e..ef9b7480b8 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -498,17 +498,14 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data, * network encoding not the host encoding. */ result = Curl_convert_to_network(data, (char *)pw, len * 2); - if(result) - return result; - - /* Create NT hashed password. */ - Curl_md4it(ntbuffer, pw, 2 * len); - - memset(ntbuffer + 16, 0, 21 - 16); - + if(!result) { + /* Create NT hashed password. */ + Curl_md4it(ntbuffer, pw, 2 * len); + memset(ntbuffer + 16, 0, 21 - 16); + } free(pw); - return CURLE_OK; + return result; } #if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)