summaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:19:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:20:17 +0000
commita64a253794ac64cb40befee54db53bde17dd0d49 (patch)
treec1024acc5f6e508814b944d99f112259bb28b1be /src/url.c
parentNew upstream version 1.10.0+dfsg (diff)
downloadnetdata-upstream/1.11.0+dfsg.tar.xz
netdata-upstream/1.11.0+dfsg.zip
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--libnetdata/url/url.c (renamed from src/url.c)8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/url.c b/libnetdata/url/url.c
index 6be4d9648..07a9f8069 100644
--- a/src/url.c
+++ b/libnetdata/url/url.c
@@ -1,4 +1,6 @@
-#include "common.h"
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "../libnetdata.h"
// ----------------------------------------------------------------------------
// URL encode / decode
@@ -58,7 +60,9 @@ char *url_decode_r(char *to, char *url, size_t size) {
while(*s && d < e) {
if(unlikely(*s == '%')) {
if(likely(s[1] && s[2])) {
- *d++ = from_hex(s[1]) << 4 | from_hex(s[2]);
+ char t = from_hex(s[1]) << 4 | from_hex(s[2]);
+ // avoid HTTP header injection
+ *d++ = (char)((isprint(t))? t : ' ');
s += 2;
}
}