summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Goodbody <andrew.goodbody@linaro.org>2025-06-30 12:57:10 +0100
committerTom Rini <trini@konsulko.com>2025-07-08 18:15:20 -0600
commitc3b43eeaead77beef53a224c7d13346a0462b34d (patch)
tree8e2a3f60594928b801a0f01e6634a99949638aa5
parent0ffd456516b5f0c126c9705d6b2368a45ee2353f (diff)
boot: pxe: Prevent evaluation of uninitialised variable
In the case where parse_sliteral returns an error then label_name will not have been assigned to. In order to prevent evaluating label_name in this case add a check for the return value of parse_sliteral. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
-rw-r--r--boot/pxe_utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 82f217aaf86..eb4d7723481 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -1348,7 +1348,7 @@ static int parse_pxefile_top(struct pxe_context *ctx, char *p, unsigned long bas
case T_ONTIMEOUT:
err = parse_sliteral(&p, &label_name);
- if (label_name) {
+ if (err >= 0 && label_name) {
if (cfg->default_label)
free(cfg->default_label);
@@ -1360,7 +1360,7 @@ static int parse_pxefile_top(struct pxe_context *ctx, char *p, unsigned long bas
case T_FALLBACK:
err = parse_sliteral(&p, &label_name);
- if (label_name) {
+ if (err >= 0 && label_name) {
if (cfg->fallback_label)
free(cfg->fallback_label);