Skip to content

Commit

Permalink
request: trim headers values also when there is no name
Browse files Browse the repository at this point in the history
As is done by libhtp-rs
  • Loading branch information
catenacyber committed Apr 30, 2024
1 parent 6a7378c commit 24e3574
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion htp/htp_request_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ htp_status_t htp_parse_request_header_generic(htp_connp_t *connp, htp_header_t *
h->name = bstr_dup_c("");
if (h->name == NULL) return HTP_ERROR;

h->value = bstr_dup_mem(data, len);
// Ignore LWS after field-content.
value_end = len - 1;
while ((value_end > 0) && (htp_is_lws(data[value_end]))) {
value_end--;
}
h->value = bstr_dup_mem(data, value_end + 1);
if (h->value == NULL) {
bstr_free(h->name);
return HTP_ERROR;
Expand Down

0 comments on commit 24e3574

Please sign in to comment.