2020-08-10 21:47:38 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Peter Jones <pjones@redhat.com>
|
|
|
|
Date: Sun, 19 Jul 2020 17:14:15 -0400
|
|
|
|
Subject: [PATCH] efi+http: fix some allocation error checking.
|
|
|
|
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
|
---
|
|
|
|
grub-core/net/efi/http.c | 11 +++++++----
|
|
|
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
|
2024-08-01 23:56:47 +00:00
|
|
|
index c37c359c713..0568ea5d43e 100644
|
2020-08-10 21:47:38 +00:00
|
|
|
--- a/grub-core/net/efi/http.c
|
|
|
|
+++ b/grub-core/net/efi/http.c
|
2024-08-01 23:56:47 +00:00
|
|
|
@@ -403,8 +403,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
|
2020-08-10 21:47:38 +00:00
|
|
|
int type)
|
|
|
|
{
|
|
|
|
grub_err_t err;
|
|
|
|
- grub_off_t size;
|
|
|
|
- char *buf;
|
|
|
|
+ grub_off_t size = 0;
|
|
|
|
+ char *buf = NULL;
|
|
|
|
char *file_name = NULL;
|
|
|
|
const char *http_path;
|
|
|
|
|
2024-08-01 23:56:47 +00:00
|
|
|
@@ -432,8 +432,11 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
|
2020-08-10 21:47:38 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
- buf = grub_malloc (size);
|
|
|
|
- efihttp_read (dev, buf, size);
|
|
|
|
+ if (size)
|
|
|
|
+ {
|
|
|
|
+ buf = grub_malloc (size);
|
|
|
|
+ efihttp_read (dev, buf, size);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
file->size = size;
|
|
|
|
file->data = buf;
|