boot: pxe_utils: Allocate space for overlay_dir before writing into it
PATCH 1/1 boot: pxe_utils: Allocate space for overlay_dir before writing into it
The pxe_utils/label_boot_extension calls snprintf on an uninitialized memory overlay_dir. This results in a crash when calling sysboot.
This commit fixes this issue.
Signed-off-by Surkov Kirill <[email protected]>
--- boot/pxe_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
boot/pxe_utils.c +2 -1
@@ -463,6 +463,8 @@ static void label_boot_extension(struct pxe_context *ctx,if (fdt_check_header (working_fdt))return ; + overlay_dir =calloc (1 , len); +/* Use fdtdir for now as the overlay devicetree directory */ if (label->fdtdir) { len =strlen (label->fdtdir);
@@ -474,7 +476,6 @@ static void label_boot_extension(struct pxe_context *ctx, slash ="" ; dir_len =strlen (label->fdtdir) +strlen (slash) +1 ; - overlay_dir =calloc (1 , len);if (!overlay_dir)return ;
Signature · 1 line
2.43.0
Hi Surkov,
Quoted 7 lines · Surkov Kirill
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
The pxe_utils/label_boot_extension calls snprintf on an uninitialized memory
overlay_dir. This results in a crash when calling sysboot.This commit fixes this issue.
I believe we already have a patch submitted for this issue:
https://lore.kernel.org/u-boot/[email protected]/T/#u
so please give that a try and a tested-by/reviewed-by there.
Cheers,
Quentin