From 9eaf512bf94e1729a2aeb146198d18d5fdb06a96 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 4 Dec 2017 15:10:45 +0000 Subject: [PATCH] Correctly handle NULL string for request arguments. When iterating over arguments of a request, the value can be a null pointer if the argument is provided without a `=`. https://www.gnu.org/software/libmicrohttpd/manual/html_node/microhttpd_002drequests.html We have to handle this correctly. Should fix #116. --- src/server/request_context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/request_context.cpp b/src/server/request_context.cpp index 212f660..8ccd5f6 100644 --- a/src/server/request_context.cpp +++ b/src/server/request_context.cpp @@ -122,7 +122,7 @@ int RequestContext::fill_argument(void *__this, enum MHD_ValueKind kind, const char *key, const char* value) { RequestContext *_this = static_cast(__this); - _this->arguments[key] = value; + _this->arguments[key] = value == nullptr ? "" : value; return MHD_YES; }