http-server icon indicating copy to clipboard operation
http-server copied to clipboard

fixed 3rd argument in memcpy (w/ null terminator)

Open mikeliaohm opened this issue 2 years ago • 1 comments

  • Fix 3rd argument in memcpy to only copy the response string length or up to kMaxBufferSize.
  • Make sure raw_response->buffer is always null terminated.

mikeliaohm avatar Mar 06 '23 03:03 mikeliaohm

Thank you for making this PR. The first change to fix memcpy's issue is good, but the second change about null termination makes me realize that a server's response could be truncated by this implementation of a fixed buffer, which is an unwanted behaviour. It's been a while since I wrote this code and I may have forgotten a few things about the requirements for an HTTP server. I'll do some research and get back to you on the change.

trungams avatar Mar 08 '23 23:03 trungams