Browse Source

Fix parsing multiple .flags variables

strlen(flagsvar) is re-evaluated on each while-loop iteration.
As \0 string terminators are added, the loop ends prematurely,
stopping after the first introduced \0 string terminator.

Signed-off-by: Bartel Eerdekens <bartel.eerdekens@constell8.be>
Signed-off-by: Stefano Babic <sbabic@denx.de>
pull/19/head
Stefano Babic 3 years ago
parent
commit
7dbfffa4cc
  1. 3
      src/uboot_env.c

3
src/uboot_env.c

@ -1077,9 +1077,10 @@ static int libuboot_load(struct uboot_ctx *ctx)
#if !defined(NDEBUG)
fprintf(stdout, "Environment FLAGS %s\n", flagsvar);
#endif
unsigned int flagslen = strlen(flagsvar);
pvar = flagsvar;
while (*pvar && (pvar - flagsvar) < strlen(flagsvar)) {
while (*pvar && (pvar - flagsvar) < flagslen) {
char *pnext;
pval = strchr(pvar, ':');
if (!pval)

Loading…
Cancel
Save