Curl_ntlm_core_mk_nt_hash: fix OOM in error path

Closes #7164
This commit is contained in:
Harry Sintonen 2021-06-01 11:31:15 +02:00 committed by Daniel Stenberg
parent b249592d29
commit f1cd5004b0
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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)