From: Yuho Choi <oss.patchbox@gmail.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Tom Rini <trini@konsulko.com>,
Masahisa Kojima <kojima.masahisa@socionext.com>,
u-boot@lists.u-boot-project.org
Subject: [PATCH] cmd: efidebug: require the URI argument of 'boot add -u'
Date: Mon, 2 Nov 2026 23:47:56 -0500 [thread overview]
Message-ID: <20261103044822.583008-1-oss.patchbox@gmail.com> (raw)
efi_boot_add_uri() is called with argv[0] pointing to "-u" and reads
the boot option id, the label and the URI from argv[1] to argv[3], but
it only requires argc >= 3. When the URI is left out, as in
efidebug boot add -u 1 label
argv[3] is the NULL pointer that terminates the argument list. It is
passed to wget_validate_uri(), which dereferences it in strchr(). On
sandbox the command crashes with a segmentation fault.
Require four arguments, so that a missing URI is reported as a usage
error.
Fixes: f01c961ee34c ("cmd: efidebug: add uri device path")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Tested on sandbox_defconfig with EFI_HTTP_BOOT=y: without this patch
'efidebug boot add -u 1 NoUri' crashes with a segmentation fault; with
it the command prints the usage and returns 1.
'efidebug boot add -u 7 Uri http://1.2.3.4/a.efi' still creates
Boot0007 with the URI device path.
cmd/efidebug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index f7329156038..09d14ffd3b4 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -742,7 +742,7 @@ static int efi_boot_add_uri(int argc, char *const argv[], u16 *var_name16,
efi_uintn_t uridp_len;
struct efi_device_path_uri *uridp;
- if (argc < 3 || lo->label)
+ if (argc < 4 || lo->label)
return CMD_RET_USAGE;
id = (int)hextoul(argv[1], &endp);
--
2.43.0
reply other threads:[~2026-11-03 13:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103044822.583008-1-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=kojima.masahisa@socionext.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox