See patch
Consider a string with non-printable characters a "bad value". Otherwise nvramtool -a with random cmos contents can mess up your terminal.
Signed-off-by: Stefan Reinauer <[email protected]> Index: util/nvramtool/nvramtool.c =================================================================== --- util/nvramtool/nvramtool.c (revision 5007) +++ util/nvramtool/nvramtool.c (working copy) @@ -672,6 +672,7 @@ { const cmos_enum_t *p; unsigned long long value; + char *w; /* sanity check CMOS entry */ switch (prepare_cmos_read(e)) { @@ -741,12 +742,27 @@ break; case CMOS_ENTRY_STRING: - if (show_name) - printf("%s = %s\n", e->name, - (char *)(unsigned long)value); - else - printf("%s\n", (char *)(unsigned long)value); + w = (char *)(unsigned long)value; + while (*w) { + if(!isprint(*w)) { + if (show_name) + printf("# Bad value -> %s\n", e->name); + else + printf("Bad value\n"); + break; + } + w++; + } + if (!*w) { + + if (show_name) + printf("%s = %s\n", e->name, + (char *)(unsigned long)value); + else + printf("%s\n", (char *)(unsigned long)value); + } + free((void *)(unsigned long)value); break;
-- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

