lwIP - A Lightweight TCP/IP stack - Bugs: bug #58754, httpd.c fix of incorrect...
You are not allowed to post comments on this tracker with your current authentication level.
bug #58754: httpd.c fix of incorrect null-termination of request-headers and other improvements
Submitter: | Alister Fisher <afisher> | ||
Submitted: | Sun 12 Jul 2020 05:23:15 AM UTC | ||
Category: | apps | Severity: | 3 - Normal |
Item Group: | Change Request | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open | Planned Release: | None |
lwIP version: | git head |
Attached Files
file #49474: 0001-Fix-HTTP-server-null-termination-of-request-headers-.patch added by afisher (28KiB - application/octet-stream)
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follows 1 latest change.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2020-07-12 | afisher | Attached File | - | Added 0001-Fix-HTTP-server-null-termination-of-request-headers-.patch, #49474 |
Powered by Savane 3.13-3e34.
Corresponding source code
http_post_request incorrectly null-terminates the headers at the last header's CRLF. That CRLF belongs to the last header and is necessary for header-value searches. http_post_request itself uses a search of CRLF to find the content-length header's value.
It should null-terminate at the empty-line that immediately follows it.
The improvements include
- Removed second search for request's empty-line.
- Search for headers from start of headers.
- Removed two impossible LWIP_MIN cases.
- Moved struct http_state and struct http_ssi_state to httpd_priv.h to facilitate adding future features separate to httpd.c, e.g. websockets, which was suggested by Simon Goldschmidt at https://savannah.nongnu.org/patch/?9525.
- Removed unnecessary "+ 1" from httpd_req_buf's array definition and added 1 to LWIP_HTTPD_MAX_REQ_LENGTH's default definition.
- Moved http_remove_connection into http_state_eof. Reduces code size.
- Return ERR_ABRT from http_close_or_abort_conn if it calls altcp_abort. No effect on execution. But more technically correct.
- Misc commenting.
The patch is to c385f31076b27efb8ee37f00cb5568783a58f299, the git head at the time this bug was submitted.