Blame SOURCES/0308-efi-http-fix-some-allocation-error-checking.patch
|
|
80913e |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
80913e |
From: Peter Jones <pjones@redhat.com>
|
|
|
80913e |
Date: Sun, 19 Jul 2020 17:14:15 -0400
|
|
|
80913e |
Subject: [PATCH] efi+http: fix some allocation error checking.
|
|
|
80913e |
|
|
|
80913e |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
80913e |
---
|
|
|
80913e |
grub-core/net/efi/http.c | 11 +++++++----
|
|
|
80913e |
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
80913e |
|
|
|
80913e |
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
|
|
|
80913e |
index fc8cb25ae0a..26647a50fa4 100644
|
|
|
80913e |
--- a/grub-core/net/efi/http.c
|
|
|
80913e |
+++ b/grub-core/net/efi/http.c
|
|
|
80913e |
@@ -412,8 +412,8 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
|
|
|
80913e |
int type)
|
|
|
80913e |
{
|
|
|
80913e |
grub_err_t err;
|
|
|
80913e |
- grub_off_t size;
|
|
|
80913e |
- char *buf;
|
|
|
80913e |
+ grub_off_t size = 0;
|
|
|
80913e |
+ char *buf = NULL;
|
|
|
80913e |
char *file_name = NULL;
|
|
|
80913e |
const char *http_path;
|
|
|
80913e |
|
|
|
80913e |
@@ -441,8 +441,11 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
|
|
|
80913e |
return err;
|
|
|
80913e |
}
|
|
|
80913e |
|
|
|
80913e |
- buf = grub_malloc (size);
|
|
|
80913e |
- efihttp_read (dev, buf, size);
|
|
|
80913e |
+ if (size)
|
|
|
80913e |
+ {
|
|
|
80913e |
+ buf = grub_malloc (size);
|
|
|
80913e |
+ efihttp_read (dev, buf, size);
|
|
|
80913e |
+ }
|
|
|
80913e |
|
|
|
80913e |
file->size = size;
|
|
|
80913e |
file->data = buf;
|