diff options
author | Harry Sintonen <sintonen@iki.fi> | 2021-06-01 11:31:15 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-06-01 13:38:01 +0200 |
commit | f1cd5004b0965884af0c1e5f268ae799e24f4f16 (patch) | |
tree | b9436130cc8ca1c5b9bd7d436d66a92be9bdb752 /lib | |
parent | b249592d29ae0a2b3e8e07fdbc01f33b5a5b8420 (diff) | |
download | curl-f1cd5004b0965884af0c1e5f268ae799e24f4f16.tar.gz |
Curl_ntlm_core_mk_nt_hash: fix OOM in error path
Closes #7164
Diffstat (limited to 'lib')
-rw-r--r-- | lib/curl_ntlm_core.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index 89d4ec872..ef9b7480b 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) |