mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-13 21:56:57 +00:00
sbat: Fix two NULL derefs found with "gcc -fanalyzer"
"gcc -fanalyzer" found two NULL pointer checks we're missing in sbat.c: include/str.h: In function ‘get_sbat_field.part.0’: sbat.c:20:14: error: dereference of NULL ‘offset’ [CWE-476] [-Werror=analyzer-null-dereference] 20 | if (!*offset) and include/str.h: In function ‘parse_sbat’: sbat.c:140:27: error: dereference of NULL ‘current’ [CWE-476] [-Werror=analyzer-null-dereference] 140 | } while (entry && *current != '\0'); Both are simple, and this patch fixes them. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
8e34030ba5
commit
9bef30f529
4
sbat.c
4
sbat.c
@ -17,7 +17,7 @@ get_sbat_field(CHAR8 *current, CHAR8 *end, const CHAR8 **field, char delim)
|
||||
offset = strchrnula(current, delim);
|
||||
*field = current;
|
||||
|
||||
if (!*offset)
|
||||
if (!offset || !*offset)
|
||||
return NULL;
|
||||
|
||||
*offset = '\0';
|
||||
@ -137,7 +137,7 @@ parse_sbat(char *sbat_base, size_t sbat_size, size_t *sbats, struct sbat_entry *
|
||||
n = nsize / sizeof(entry);
|
||||
}
|
||||
entries[i++] = entry;
|
||||
} while (entry && *current != '\0');
|
||||
} while (entry && current && *current != '\0');
|
||||
|
||||
*sbats = i;
|
||||
*sbat = entries;
|
||||
|
Loading…
Reference in New Issue
Block a user