Fix out-of-bounds access if all erase functions fail.
Signed-off-by: Carl-Daniel Hailfinger <[email protected]> Index: flashrom-fix_erasefunctions_nullpointer/flashrom.c =================================================================== --- flashrom-fix_erasefunctions_nullpointer/flashrom.c (Revision 1280) +++ flashrom-fix_erasefunctions_nullpointer/flashrom.c (Arbeitskopie) @@ -1514,8 +1514,12 @@ memcpy(curcontents, oldcontents, size); for (k = 0; k< NUM_ERASEFUNCTIONS; k++) { + if (!usable_erasefunctions) { + msg_cdbg("No usable erase functions left.\n"); + break; + } msg_cdbg("Looking at blockwise erase function %i... ", k); - if (check_block_eraser(flash, k, 1)&& usable_erasefunctions) { + if (check_block_eraser(flash, k, 1)) { msg_cdbg("Looking for another erase function.\n"); continue; } -- http://www.hailfinger.org/ _______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
