Fix CVE-2019-3822

Merge: curl/curl@50c9484278
This commit is contained in:
Kawe Mazidjatari 2023-06-12 20:48:21 +02:00
parent 46f11218c6
commit 52d8ef5719

View File

@ -769,11 +769,14 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
}); });
#ifdef USE_NTRESPONSES #ifdef USE_NTRESPONSES
if(size < (NTLM_BUFSIZE - ntresplen)) { /* ntresplen + size should not be risking an integer overflow here */
DEBUGASSERT(size == (size_t)ntrespoff); if(ntresplen + size > sizeof(ntlmbuf)) {
memcpy(&ntlmbuf[size], ptr_ntresp, ntresplen); failf(data, "incoming NTLM message too big");
size += ntresplen; return CURLE_OUT_OF_MEMORY;
} }
DEBUGASSERT(size == (size_t)ntrespoff);
memcpy(&ntlmbuf[size], ptr_ntresp, ntresplen);
size += ntresplen;
DEBUG_OUT({ DEBUG_OUT({
fprintf(stderr, "\n ntresp="); fprintf(stderr, "\n ntresp=");