Skip to content

Commit ee1809e

Browse files
FlyGoattsbogend
authored andcommitted
MIPS: fw: Allow firmware to pass a empty env
fw_getenv will use env entry to determine style of env, however it is legal for firmware to just pass a empty list. Check if first entry exist before running strchr to avoid null pointer dereference. Cc: stable@vger.kernel.org Link: clbr/n64bootloader#5 Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 7fb6f7b commit ee1809e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/mips/fw/lib/cmdline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ char *fw_getenv(char *envname)
5353
{
5454
char *result = NULL;
5555

56-
if (_fw_envp != NULL) {
56+
if (_fw_envp != NULL && fw_envp(0) != NULL) {
5757
/*
5858
* Return a pointer to the given environment variable.
5959
* YAMON uses "name", "value" pairs, while U-Boot uses

0 commit comments

Comments
 (0)