Skip to content

webserver: Fix garbage output on debug print#244

Merged
etr merged 1 commit intoetr:masterfrom
LeSpocky:debug-print
Nov 12, 2021
Merged

webserver: Fix garbage output on debug print#244
etr merged 1 commit intoetr:masterfrom
LeSpocky:debug-print

Conversation

@LeSpocky
Copy link
Copy Markdown
Contributor

Identify the Bug

#242

Description of the Change

Consider the upload date size passed by libmicrohttpd to construct a std::string, instead of blindly relying on null termination.

Alternate Designs

N/A

Possible Drawbacks

unsure

Verification Process

Logging output with that fix:

Writing content: {"login":{"pass":"admin","user":"admin"}}
Writing content: {"login":{"pass":"admin","user":"admin"}}

(See #242 for how it was before.)

Release Notes

N/A

The `upload_data` we get in the callback from libmicrohttpd might not be
null terminated.

Fixes: etr#242
Signed-off-by: Alexander Dahl <ada@thorsis.com>
@etr
Copy link
Copy Markdown
Owner

etr commented Nov 12, 2021

Thanks for taking care of this!

@etr etr merged commit 8901082 into etr:master Nov 12, 2021
@LeSpocky LeSpocky deleted the debug-print branch November 12, 2021 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants