Loading lib/curl_ntlm_core.c +18 −2 Original line number Diff line number Diff line Loading @@ -646,6 +646,12 @@ CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen, return CURLE_OK; } #if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4) #define SIZE_T_MAX 18446744073709551615U #else #define SIZE_T_MAX 4294967295U #endif /* This creates the NTLMv2 hash by using NTLM hash as the key and Unicode * (uppercase UserName + Domain) as the data */ Loading @@ -655,10 +661,20 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen, unsigned char *ntlmv2hash) { /* Unicode representation */ size_t identity_len = (userlen + domlen) * 2; unsigned char *identity = malloc(identity_len); size_t identity_len; unsigned char *identity; CURLcode result = CURLE_OK; /* we do the length checks below separately to avoid integer overflow risk on extreme data lengths */ if((userlen > SIZE_T_MAX/2) || (domlen > SIZE_T_MAX/2) || ((userlen + domlen) > SIZE_T_MAX/2)) return CURLE_OUT_OF_MEMORY; identity_len = (userlen + domlen) * 2; identity = malloc(identity_len); if(!identity) return CURLE_OUT_OF_MEMORY; Loading Loading
lib/curl_ntlm_core.c +18 −2 Original line number Diff line number Diff line Loading @@ -646,6 +646,12 @@ CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen, return CURLE_OK; } #if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4) #define SIZE_T_MAX 18446744073709551615U #else #define SIZE_T_MAX 4294967295U #endif /* This creates the NTLMv2 hash by using NTLM hash as the key and Unicode * (uppercase UserName + Domain) as the data */ Loading @@ -655,10 +661,20 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen, unsigned char *ntlmv2hash) { /* Unicode representation */ size_t identity_len = (userlen + domlen) * 2; unsigned char *identity = malloc(identity_len); size_t identity_len; unsigned char *identity; CURLcode result = CURLE_OK; /* we do the length checks below separately to avoid integer overflow risk on extreme data lengths */ if((userlen > SIZE_T_MAX/2) || (domlen > SIZE_T_MAX/2) || ((userlen + domlen) > SIZE_T_MAX/2)) return CURLE_OUT_OF_MEMORY; identity_len = (userlen + domlen) * 2; identity = malloc(identity_len); if(!identity) return CURLE_OUT_OF_MEMORY; Loading