diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-10-16 20:22:20 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-10-16 20:19:33 +0100 |
commit | 7a91296f1de22eef430734f000fa00978a35930b (patch) | |
tree | 15e4d5aad4afe11d4f1ad1c71f2153d1195eae51 /lib | |
parent | c927c92086b1b0b0ab217409f4b87884ac1f0faa (diff) |
ntlm: Avoid unnecessary buffer allocation for SSPI based type-2 token
Diffstat (limited to 'lib')
-rw-r--r-- | lib/curl_ntlm_msgs.c | 10 | ||||
-rw-r--r-- | lib/urldata.h | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/curl_ntlm_msgs.c b/lib/curl_ntlm_msgs.c index 0b76827e7..0c983b781 100644 --- a/lib/curl_ntlm_msgs.c +++ b/lib/curl_ntlm_msgs.c @@ -297,13 +297,8 @@ CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data, } #ifdef USE_WINDOWS_SSPI - ntlm->type_2 = malloc(size + 1); - if(ntlm->type_2 == NULL) { - free(buffer); - return CURLE_OUT_OF_MEMORY; - } + ntlm->type_2 = buffer; ntlm->n_type_2 = curlx_uztoul(size); - memcpy(ntlm->type_2, buffer, size); #else ntlm->flags = 0; @@ -336,8 +331,9 @@ CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data, fprintf(stderr, "\n****\n"); fprintf(stderr, "**** Header %s\n ", header); }); -#endif + free(buffer); +#endif return CURLE_OK; } diff --git a/lib/urldata.h b/lib/urldata.h index e9ddf30b8..900b8c8ad 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -442,7 +442,7 @@ struct ntlmdata { size_t max_token_length; BYTE *output_token; int has_handles; - void *type_2; + BYTE *type_2; unsigned long n_type_2; #else unsigned int flags; |