[coreboot-gerrit] New patch to review for coreboot: cbmem: fix fault on console overflow

Ben Gardner (gardner.ben@gmail.com) gerrit at coreboot.org
Wed Nov 18 21:38:20 CET 2015


Ben Gardner (gardner.ben at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12459

-gerrit

commit bc4cd8582946f8469db8ac3d4e7f2b4369142922
Author: Ben Gardner <gardner.ben at gmail.com>
Date:   Wed Nov 18 14:37:45 2015 -0600

    cbmem: fix fault on console overflow
    
    In dump_console(), if cursor > size the following will fault, as only
    size + 1 bytes were allocated:
    	console_c[cursor] = 0;
    
    That line is not needed, since size <= console and this line is present:
    	console_c[size] = 0;
    
    Change-Id: If1c9a6fe0d926c767e2aff947254f22b2758c234
    Signed-off-by: Ben Gardner <gardner.ben at gmail.com>
---
 util/cbmem/cbmem.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 3c7f49b..3df571e 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -696,7 +696,6 @@ static void dump_console(void)
 	                            size + sizeof(size) + sizeof(cursor), 1);
 	memcpy(console_c, console_p + 8, size);
 	console_c[size] = 0;
-	console_c[cursor] = 0;
 
 	printf("%s\n", console_c);
 	if (size < cursor)



More information about the coreboot-gerrit mailing list