public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: Francis Laniel <francis.laniel@amarulasolutions.com>
Cc: u-boot@lists.denx.de, joe.hershberger@ni.com,
	michael@amarulasolutions.com, ondrej@amarulasolutions.com
Subject: Re: [RFC PATCH v2 1/1] cmd: nvedit: Forbid key to be empty.
Date: Wed, 30 Jun 2021 09:38:16 +0200	[thread overview]
Message-ID: <138836.1625038696@gemini.denx.de> (raw)
In-Reply-To: <20210629161859.298630-2-francis.laniel@amarulasolutions.com>

Dear Francis Laniel,

In message <20210629161859.298630-2-francis.laniel@amarulasolutions.com> you wrote:
> Before this patch, it was possible to do the following using setenv:
> setenv '' foo
> Then, on next reboot, U-Boot will not be able to parse environment due to it
> having:
> =foo
>
> Now, if the above command is given, an error message is thrown and environment
> is not modified.
>
> Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
> ---
>  cmd/nvedit.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index d14ba10cef..6f99a85a9c 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -262,6 +262,11 @@ static int _do_env_set(int flag, int argc, char *const argv[], int env_flag)
>  		return 1;
>  	}
>  
> +	if (*name == '\0') {
> +		printf("## Error: variable name must no be empty\n");
> +		return 1;
> +	}
> +
>  	env_id++;
>  
>  	/* Delete only ? */

Reviewed-by: Wolfgang Denk <wd@denx.de>


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"I can call spirits from the vasty deep."
"Why so can I, or so can any man; but will they come when you do call
for them?"          - Shakespeare, 1 King Henry IV, Act III, Scene I.

  reply	other threads:[~2021-06-30  7:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 16:18 [RFC PATCH v2 0/1] cmd: nvedit: Forbid environment key to be empty Francis Laniel
2021-06-29 16:18 ` [RFC PATCH v2 1/1] cmd: nvedit: Forbid " Francis Laniel
2021-06-30  7:38   ` Wolfgang Denk [this message]
2021-06-30  7:45     ` Francis Laniel

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=138836.1625038696@gemini.denx.de \
    --to=wd@denx.de \
    --cc=francis.laniel@amarulasolutions.com \
    --cc=joe.hershberger@ni.com \
    --cc=michael@amarulasolutions.com \
    --cc=ondrej@amarulasolutions.com \
    --cc=u-boot@lists.denx.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