This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fconfig patch

When running a new RedBoot on a board which had a very old RedBoot
installed, I ran into a problem with the old fconfig data. The new
RedBoot was looking for an option that did not exist in the old data.
At some point an incompatibility must have been introduced because the
new RedBoot went into an infinite loop. This patch ensures that the
loop will always move forwards through the fconfig data, preventing
the infinite loop.


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.

Index: src/fconfig.c
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fconfig.c,v
retrieving revision 1.15
diff -u -p -r1.15 fconfig.c
--- src/fconfig.c	18 Nov 2008 01:28:12 -0000	1.15
+++ src/fconfig.c	20 Nov 2008 21:19:02 -0000
@@ -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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]