mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Fix parsing of empty headers
This commit is contained in:
parent
5001a59a87
commit
43edea5013
1 changed files with 3 additions and 3 deletions
|
|
@ -974,7 +974,7 @@ int http_parse_header(struct http_header **result, const char *header)
|
|||
/* Copy the header field value until we hit a CRLF. */
|
||||
p = q + 1;
|
||||
p = skip_lws(p);
|
||||
while (*p != '\0' && !is_crlf(p)) {
|
||||
do {
|
||||
if (value_len > 0) {
|
||||
/* Replace LWS with a single space. */
|
||||
strbuf_append_str(&node->value, &value_len, &value_offset, " ");
|
||||
|
|
@ -982,14 +982,14 @@ int http_parse_header(struct http_header **result, const char *header)
|
|||
q = p;
|
||||
while (*q != '\0' && !is_space_char(*q) && !is_crlf(q)) {
|
||||
if (is_ctl_char(*q)) {
|
||||
http_header_node_free(node);
|
||||
FREE_AND_NULL(http_header_free, *result);
|
||||
return 400;
|
||||
}
|
||||
q++;
|
||||
}
|
||||
strbuf_append(&node->value, &value_len, &value_offset, p, q - p);
|
||||
p = skip_lws(q);
|
||||
}
|
||||
} while (*p != '\0' && !is_crlf(p));
|
||||
*prev = node;
|
||||
prev = &node->next;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue