Index: fconfig.c =================================================================== RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fconfig.c,v retrieving revision 1.11 diff -u -u -r1.11 fconfig.c --- fconfig.c 9 Nov 2004 18:46:38 -0000 1.11 +++ fconfig.c 30 Jun 2005 04:10:18 -0000 @@ -262,7 +262,7 @@ char *esp; #endif void *val_ptr; - int type; + int type, script_len; if (CONFIG_OBJECT_ENABLE_KEYLEN(dp)) { flash_get_config(CONFIG_OBJECT_ENABLE_KEY(dp), &enable, CONFIG_BOOL); @@ -433,6 +433,7 @@ case CONFIG_SCRIPT: // Assume it always changes sp = (unsigned char *)val_ptr; + script_len = 0; diag_printf("Enter script, terminate with empty line\n"); while (true) { *sp = '\0'; @@ -440,6 +441,12 @@ ret = _rb_gets(line, sizeof(line), 0); if (ret < 0) return CONFIG_ABORT; if (strlen(line) == 0) break; + script_len += strlen(line) + 1; + if (script_len > config_length(CONFIG_SCRIPT)) { + diag_printf("script longer than %d not allowed!\n", + config_length(CONFIG_SCRIPT)); + return CONFIG_ABORT; + } lp = line; while (*lp) { *sp++ = *lp++;