From cef43498a141c36f76350fa7a7f928d22bcc6e52 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Fri, 12 Nov 2021 15:57:41 +0100 Subject: [PATCH] webserver: Fix garbage output on debug print The `upload_data` we get in the callback from libmicrohttpd might not be null terminated. Fixes: #242 Signed-off-by: Alexander Dahl --- src/webserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webserver.cpp b/src/webserver.cpp index 40ce85cb..363ac0ce 100644 --- a/src/webserver.cpp +++ b/src/webserver.cpp @@ -525,7 +525,7 @@ MHD_Result webserver::requests_answer_second_step(MHD_Connection* connection, co if (mr->has_body) { #ifdef DEBUG - std::cout << "Writing content: " << upload_data << std::endl; + std::cout << "Writing content: " << std::string(upload_data, *upload_data_size) << std::endl; #endif // DEBUG mr->dhr->grow_content(upload_data, *upload_data_size);