
21 Jan
2005
21 Jan
'05
1:23 p.m.
Neil Bryan nbryan@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