Skip to content

Commit

Permalink
reject message with different values in multiple Content-Length heade…
Browse files Browse the repository at this point in the history
…r field

Signed-off-by: Dennis Tseng <dennis.tseng@suse.com>
  • Loading branch information
dennis-tseng99 committed Feb 14, 2024
1 parent 5914984 commit 4c87f7b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion httpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ receive_http_response(EFI_HTTP_PROTOCOL *http, VOID **buffer, UINT64 *buf_size)
EFI_HTTP_RESPONSE_DATA response;
EFI_HTTP_STATUS_CODE http_status;
BOOLEAN response_done;
UINTN i, downloaded;
UINTN i, j, downloaded;
CHAR8 rx_buffer[9216];
EFI_STATUS efi_status;
EFI_STATUS event_status;
Expand Down Expand Up @@ -574,6 +574,15 @@ receive_http_response(EFI_HTTP_PROTOCOL *http, VOID **buffer, UINT64 *buf_size)
if (!strcasecmp(rx_message.Headers[i].FieldName,
(CHAR8 *)"Content-Length")) {
*buf_size = ascii_to_int(rx_message.Headers[i].FieldValue);
for(j = 0; j < i; j++) {
if (!strcasecmp(rx_message.Headers[i].FieldName,
(CHAR8 *)"Content-Length")) {
if (*buf_size != ascii_to_int(rx_message.Headers[j].FieldValue)) {
perror(L"Content-Length is invalid\n");
goto error;
}
}
}
}
}

Expand Down

0 comments on commit 4c87f7b

Please sign in to comment.