summaryrefslogtreecommitdiff
path: root/httpboot.c
diff options
context:
space:
mode:
authorBastien Roucariès <rouca@debian.org>2024-05-06 19:17:23 +0000
committerBastien Roucariès <rouca@debian.org>2024-05-06 19:17:23 +0000
commit0d1d760b90dfe26145b7c4e4cd0de55117bcdbbb (patch)
treea66ff512cd9be70de19d8983a2a04b9a1d03da6b /httpboot.c
parentee3097c3f96727fdb41e36d93b6c957d281da97e (diff)
parenta075e58606b9affb6dfb176c71caab816737a981 (diff)
downloadefi-boot-shim-0d1d760b90dfe26145b7c4e4cd0de55117bcdbbb.tar.gz
efi-boot-shim-0d1d760b90dfe26145b7c4e4cd0de55117bcdbbb.zip
Merge tag 'upstream/15.8' into buster/updates
Upstream version 15.8
Diffstat (limited to 'httpboot.c')
-rw-r--r--httpboot.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/httpboot.c b/httpboot.c
index dfa493bf..ac9ea25c 100644
--- a/httpboot.c
+++ b/httpboot.c
@@ -578,7 +578,13 @@ receive_http_response(EFI_HTTP_PROTOCOL *http, VOID **buffer, UINT64 *buf_size)
}
if (*buf_size == 0) {
- perror(L"Failed to get Content-Lenght\n");
+ perror(L"Failed to get Content-Length\n");
+ goto error;
+ }
+
+ if (*buf_size < rx_message.BodyLength) {
+ efi_status = EFI_BAD_BUFFER_SIZE;
+ perror(L"Invalid Content-Length\n");
goto error;
}
@@ -713,18 +719,20 @@ error:
}
EFI_STATUS
-httpboot_fetch_buffer (EFI_HANDLE image, VOID **buffer, UINT64 *buf_size)
+httpboot_fetch_buffer (EFI_HANDLE image, VOID **buffer, UINT64 *buf_size,
+ CHAR8 *name)
{
EFI_STATUS efi_status;
EFI_HANDLE nic;
- CHAR8 next_loader[sizeof DEFAULT_LOADER_CHAR];
+ CHAR8 *next_loader;
CHAR8 *next_uri = NULL;
CHAR8 *hostname = NULL;
if (!uri)
return EFI_NOT_READY;
- translate_slashes(next_loader, DEFAULT_LOADER_CHAR);
+ next_loader = (CHAR8 *)AllocatePool((strlen(name) + 1) * sizeof (CHAR8));
+ translate_slashes(next_loader, name);
/* Create the URI for the next loader based on the original URI */
efi_status = generate_next_uri(uri, next_loader, &next_uri);