My C is rusty, but what happens if "handle_request" gets a request that's BUFFER_SIZE+1 "A"s?
Seems to me like "read" will read exactly BUFFER_SIZE "A"s and no null-terminator, causing the subsequent "strsep" to find the first \n... someplace in memory (after the buffer) and overwrite it with a null-terminator.
Thank you, you are right - and I appreciate the rusty pun. I think, as a general thing, there are a few things that I would do differently if I wanted to build a production version of this code. Firstly I would find a better way of parsing the headers. :)
Seems to me like "read" will read exactly BUFFER_SIZE "A"s and no null-terminator, causing the subsequent "strsep" to find the first \n... someplace in memory (after the buffer) and overwrite it with a null-terminator.