Reject HTTP requests with an invalid (e.g. negative) Content-Length header value.

Make sure to allocate enough memory in buffers for the operations they are used for, and to check/enforce buffer sizes when performing those memory operations.
Properly allocate and free memory.
Make a best effort at allocating memory for the network hardware address (remove code for Apple platforms).
Try to consume all of the remaining content if a valid Content-Length header was provided.
Check for success when attempting to acquire mutexes.
This commit is contained in:
Wesley Miaw
2019-10-07 14:38:16 -07:00
parent 8c13345a4d
commit 93756a84ea
10 changed files with 555 additions and 300 deletions

View File

@@ -34,7 +34,7 @@
* Concatenate a maxim of max_chars characters from src into dest,
* and return a pointer to the last character in dest.
*/
char* smartstrcat(char* dest, char* src, size_t max_chars);
char* smartstrncpy(char* dest, char* src, size_t max_chars);
int urldecode(char *dst, const char *src, size_t max_size);