summaryrefslogtreecommitdiffstats
path: root/ext/yahttp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:28:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:28:37 +0000
commit037d41a914237592dc3e82751b8be3ff06407af0 (patch)
treef111444510b128085cbd03f7e72bcddcdef8a7e3 /ext/yahttp
parentReleasing progress-linux version 1.9.4-1~progress7.99u1. (diff)
downloaddnsdist-037d41a914237592dc3e82751b8be3ff06407af0.tar.xz
dnsdist-037d41a914237592dc3e82751b8be3ff06407af0.zip
Merging upstream version 1.9.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/yahttp')
-rw-r--r--ext/yahttp/yahttp/utility.hpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/ext/yahttp/yahttp/utility.hpp b/ext/yahttp/yahttp/utility.hpp
index 1d5e41e..47457e3 100644
--- a/ext/yahttp/yahttp/utility.hpp
+++ b/ext/yahttp/yahttp/utility.hpp
@@ -1,4 +1,13 @@
#pragma once
+
+#ifndef YAHTTP_MAX_REQUEST_LINE_SIZE
+#define YAHTTP_MAX_REQUEST_LINE_SIZE 8192
+#endif
+
+#ifndef YAHTTP_MAX_REQUEST_FIELDS
+#define YAHTTP_MAX_REQUEST_FIELDS 100
+#endif
+
namespace YaHTTP {
static const char *MONTHS[] = {0,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",0}; //<! List of months
static const char *DAYS[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat",0}; //<! List of days
@@ -364,7 +373,10 @@ namespace YaHTTP {
}
}; //<! static HTTP codes to text mappings
- static strstr_map_t parseUrlParameters(std::string parameters) {
+ static strstr_map_t parseUrlParameters(const std::string& parameters) {
+ if (parameters.size() > YAHTTP_MAX_REQUEST_LINE_SIZE) {
+ return {};
+ }
std::string::size_type pos = 0;
strstr_map_t parameter_map;
while (pos != std::string::npos) {
@@ -390,13 +402,14 @@ namespace YaHTTP {
// no parameters at all
break;
}
- key = decodeURL(key);
- value = decodeURL(value);
- parameter_map[key] = std::move(value);
+ parameter_map[decodeURL(key)] = decodeURL(value);
if (nextpos == std::string::npos) {
// no more parameters left
break;
}
+ if (parameter_map.size() >= YAHTTP_MAX_REQUEST_FIELDS) {
+ break;
+ }
pos = nextpos+1;
}