aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/curl/patches/401-CVE-2018-14618.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/utils/curl/patches/401-CVE-2018-14618.patch')
-rw-r--r--package/network/utils/curl/patches/401-CVE-2018-14618.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/package/network/utils/curl/patches/401-CVE-2018-14618.patch b/package/network/utils/curl/patches/401-CVE-2018-14618.patch
new file mode 100644
index 0000000000..62d513c22e
--- /dev/null
+++ b/package/network/utils/curl/patches/401-CVE-2018-14618.patch
@@ -0,0 +1,32 @@
+From 57d299a499155d4b327e341c6024e293b0418243 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Mon, 13 Aug 2018 10:35:52 +0200
+Subject: [PATCH] Curl_ntlm_core_mk_nt_hash: return error on too long password
+
+... since it would cause an integer overflow if longer than (max size_t
+/ 2).
+
+This is CVE-2018-14618
+
+Bug: https://curl.haxx.se/docs/CVE-2018-14618.html
+Closes #2756
+Reported-by: Zhaoyang Wu
+---
+ lib/curl_ntlm_core.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/lib/curl_ntlm_core.c
++++ b/lib/curl_ntlm_core.c
+@@ -557,8 +557,11 @@ CURLcode Curl_ntlm_core_mk_nt_hash(struc
+ unsigned char *ntbuffer /* 21 bytes */)
+ {
+ size_t len = strlen(password);
+- unsigned char *pw = len ? malloc(len * 2) : strdup("");
++ unsigned char *pw;
+ CURLcode result;
++ if(len > SIZE_T_MAX/2) /* avoid integer overflow */
++ return CURLE_OUT_OF_MEMORY;
++ pw = len ? malloc(len * 2) : strdup("");
+ if(!pw)
+ return CURLE_OUT_OF_MEMORY;
+