# HG changeset patch # User bartv # Date 1227216446 0 # Node ID 80c8675af39aef717e4bb56fb5a5081f35639d4c # Parent 5ba0b3e7a0cb185dff213d5311dfa6340ab2137c Stop RedBoot going into an infinite loop when there is something dodgy in the fconfig area. diff --git a/packages/redboot/current/ChangeLog b/packages/redboot/current/ChangeLog --- a/packages/redboot/current/ChangeLog +++ b/packages/redboot/current/ChangeLog @@ -1,3 +1,8 @@ +2008-11-20 Bart Veer + + * src/fconfig.c (flash_lookup_config): add a sanity check to + reduce the risk of RedBoot going into an infinite loop. + 2008-11-16 Jonathan Larmour * cdl/redboot.cdl, src/flash.c, src/fconfig.c: diff --git a/packages/redboot/current/src/fconfig.c b/packages/redboot/current/src/fconfig.c --- a/packages/redboot/current/src/fconfig.c +++ b/packages/redboot/current/src/fconfig.c @@ -838,6 +838,11 @@ flash_lookup_config(char *key) if (strcmp(key, CONFIG_OBJECT_KEY(dp)) == 0) { return dp; } + // Sanity check to prevent RedBoot going into an infinite loop when + // there is something dodgy in the fconfig area. + if (len <= 0) { + break; + } dp += len; } // diag_printf("Can't find config data for '%s'\n", key);