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