summaryrefslogtreecommitdiff
path: root/lib/dict.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-10-04 18:56:45 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-10-31 08:46:35 +0100
commit53e71e47d6b81650d26ec33a58d0dca24c7ffb2c (patch)
treea5f0a1087187b889163113e83f081f8fec9d16d8 /lib/dict.c
parentc5be3d7267c725dbd093ff3a883e07ee8cf2a1d5 (diff)
downloadcurl-53e71e47d6b81650d26ec33a58d0dca24c7ffb2c.tar.gz
unescape: avoid integer overflow
CVE-2016-8622 Bug: https://curl.haxx.se/docs/adv_20161102H.html Reported-by: Cure53
Diffstat (limited to 'lib/dict.c')
-rw-r--r--lib/dict.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/dict.c b/lib/dict.c
index a7b5965bd..48a4e0a81 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -52,7 +52,7 @@
#include <curl/curl.h>
#include "transfer.h"
#include "sendf.h"
-
+#include "escape.h"
#include "progress.h"
#include "strequal.h"
#include "dict.h"
@@ -96,12 +96,12 @@ static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
char *newp;
char *dictp;
char *ptr;
- int len;
+ size_t len;
char ch;
int olen=0;
- newp = curl_easy_unescape(data, inputbuff, 0, &len);
- if(!newp)
+ CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len, FALSE);
+ if(!newp || result)
return NULL;
dictp = malloc(((size_t)len)*2 + 1); /* add one for terminating zero */