|
|
f036d1 |
From ab22e3a00f04b458039c21111cfa448051e5777d Mon Sep 17 00:00:00 2001
|
|
|
f036d1 |
From: Daniel Stenberg <daniel@haxx.se>
|
|
|
f036d1 |
Date: Thu, 3 Jan 2019 12:59:28 +0100
|
|
|
f036d1 |
Subject: [PATCH] ntlm: fix *_type3_message size check to avoid buffer overflow
|
|
|
f036d1 |
|
|
|
f036d1 |
Bug: https://curl.haxx.se/docs/CVE-2019-3822.html
|
|
|
f036d1 |
Reported-by: Wenxiang Qian
|
|
|
f036d1 |
CVE-2019-3822
|
|
|
f036d1 |
|
|
|
f036d1 |
Upstream-commit: 50c9484278c63b958655a717844f0721263939cc
|
|
|
f036d1 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
f036d1 |
---
|
|
|
f036d1 |
lib/vauth/ntlm.c | 11 +++++++----
|
|
|
f036d1 |
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
f036d1 |
|
|
|
f036d1 |
diff --git a/lib/vauth/ntlm.c b/lib/vauth/ntlm.c
|
|
|
f036d1 |
index b614cda..a3a55d9 100644
|
|
|
f036d1 |
--- a/lib/vauth/ntlm.c
|
|
|
f036d1 |
+++ b/lib/vauth/ntlm.c
|
|
|
f036d1 |
@@ -777,11 +777,14 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
|
|
|
f036d1 |
});
|
|
|
f036d1 |
|
|
|
f036d1 |
#ifdef USE_NTRESPONSES
|
|
|
f036d1 |
- if(size < (NTLM_BUFSIZE - ntresplen)) {
|
|
|
f036d1 |
- DEBUGASSERT(size == (size_t)ntrespoff);
|
|
|
f036d1 |
- memcpy(&ntlmbuf[size], ptr_ntresp, ntresplen);
|
|
|
f036d1 |
- size += ntresplen;
|
|
|
f036d1 |
+ /* ntresplen + size should not be risking an integer overflow here */
|
|
|
f036d1 |
+ if(ntresplen + size > sizeof(ntlmbuf)) {
|
|
|
f036d1 |
+ failf(data, "incoming NTLM message too big");
|
|
|
f036d1 |
+ return CURLE_OUT_OF_MEMORY;
|
|
|
f036d1 |
}
|
|
|
f036d1 |
+ DEBUGASSERT(size == (size_t)ntrespoff);
|
|
|
f036d1 |
+ memcpy(&ntlmbuf[size], ptr_ntresp, ntresplen);
|
|
|
f036d1 |
+ size += ntresplen;
|
|
|
f036d1 |
|
|
|
f036d1 |
DEBUG_OUT({
|
|
|
f036d1 |
fprintf(stderr, "\n ntresp=");
|
|
|
f036d1 |
--
|
|
|
f036d1 |
2.17.2
|
|
|
f036d1 |
|