boot: pxe: Prevent evaluation of uninitialised variable
PATCH 1/1 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 <[email protected]>
--- boot/pxe_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
boot/pxe_utils.c +2 -2
@@ -1348,7 +1348,7 @@ static int parse_pxefile_top(struct pxe_context *ctx, char *p, unsigned long bascase 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 bascase T_FALLBACK : err =parse_sliteral (&p, &label_name); -if (label_name) { +if (err >=0 && label_name) {if (cfg->fallback_label)free (cfg->fallback_label);
---
base-commit: 7027b445cc0bfb86204ecb1f1fe596f5895048d9
change-id: 20250630-boot_pxe_fix-7877ae1f4cd6
Best regards,
Signature · 1 line
Andrew Goodbody <[email protected]>
Quoted 5 lines · Andrew Goodbody
In the case where
parse_sliteralreturns an error thenlabel_namewill not have been assigned to. In order to prevent evaluatinglabel_namein this case add a check for the return value ofparse_sliteral.
Applied to u-boot/master, thanks!
[1/1] boot: pxe: Prevent evaluation of uninitialised variable
commit: c3b43eeaead77beef53a224c7d13346a0462b34d
Signature · 1 line
Tom