Re: [RFC PATCH v2 1/1] cmd: nvedit: Forbid key to be empty.

Francis Laniel
2021-06-30T07:45:51Z

Hi.

Le mercredi 30 juin 2021, 09:38:16 CEST Wolfgang Denk a écrit :
> 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>

Thank you for the review!

>
> Best regards,
>
> Wolfgang Denk