[U-Boot-Users] Possible problem in cmd_nvedit.c

Anders Larsen alarsen at rea.de
Fri Jan 21 13:23:02 CET 2005


Neil Bryan <nbryan at embebidos.com> schreibt:
>Whilst working in the above file, I noticed a possible bug in:
>
>int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>{
>   int i, j, k, nxt;
>   int rcode = 0;
>
>	if (argc == 1) {	/* Print all env variables	*/
>		for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
><SNIP>
>
>The problem is with nxt.  Now unless something magical is happening
>it appears to me that nxt is used without initialisation to modify
>i in the for-loop.

No, the problem is with <SNIP>!

The first snipped line is
	for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
which obviously sets nxt.

Cheers
 Anders





More information about the U-Boot mailing list