|
|
38ab4d |
From efc08df165e7209e79d68b25017a970c4b6c0504 Mon Sep 17 00:00:00 2001
|
|
|
5fb29d |
From: Peter Jones <pjones@redhat.com>
|
|
|
5fb29d |
Date: Wed, 10 Sep 2014 15:47:57 -0400
|
|
|
38ab4d |
Subject: [PATCH 08/31] Fix an error path not checking the return right in
|
|
|
5fb29d |
make_linux_load_option
|
|
|
5fb29d |
|
|
|
5fb29d |
Covscan once again.
|
|
|
5fb29d |
|
|
|
5fb29d |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
5fb29d |
---
|
|
|
5fb29d |
src/lib/efi.c | 10 +++++++++-
|
|
|
5fb29d |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
5fb29d |
|
|
|
5fb29d |
diff --git a/src/lib/efi.c b/src/lib/efi.c
|
|
|
5fb29d |
index 7dc3c92..a131abe 100644
|
|
|
5fb29d |
--- a/src/lib/efi.c
|
|
|
5fb29d |
+++ b/src/lib/efi.c
|
|
|
5fb29d |
@@ -722,7 +722,7 @@ make_linux_load_option(uint8_t **data, size_t *data_size)
|
|
|
5fb29d |
size_t load_option_size = sizeof (*load_option);
|
|
|
5fb29d |
efi_char16_t description[64];
|
|
|
5fb29d |
uint8_t *buf;
|
|
|
5fb29d |
- size_t needed;
|
|
|
5fb29d |
+ ssize_t needed;
|
|
|
5fb29d |
off_t buf_offset = 0, desc_offset;
|
|
|
5fb29d |
|
|
|
5fb29d |
load_option = calloc(1, sizeof (*load_option));
|
|
|
5fb29d |
@@ -754,11 +754,19 @@ make_linux_load_option(uint8_t **data, size_t *data_size)
|
|
|
5fb29d |
|
|
|
5fb29d |
if (opts.iface) {
|
|
|
5fb29d |
needed = make_net_load_option(opts.iface, NULL, 0);
|
|
|
5fb29d |
+ if (needed < 0) {
|
|
|
5fb29d |
+ free(buf);
|
|
|
5fb29d |
+ return needed;
|
|
|
5fb29d |
+ }
|
|
|
5fb29d |
buf = extend(load_option, load_option_size, needed);
|
|
|
5fb29d |
make_net_load_option(opts.iface, buf + buf_offset, needed);
|
|
|
5fb29d |
buf_offset += needed;
|
|
|
5fb29d |
} else {
|
|
|
5fb29d |
needed = make_disk_load_option(opts.iface, NULL, 0);
|
|
|
5fb29d |
+ if (needed < 0) {
|
|
|
5fb29d |
+ free(buf);
|
|
|
5fb29d |
+ return needed;
|
|
|
5fb29d |
+ }
|
|
|
5fb29d |
buf = extend(load_option, load_option_size, needed);
|
|
|
5fb29d |
make_disk_load_option(opts.iface, buf + buf_offset, needed);
|
|
|
5fb29d |
buf_offset += needed;
|
|
|
5fb29d |
--
|
|
|
38ab4d |
2.7.4
|
|
|
5fb29d |
|