[U-Boot] [PATCH 6/9] board/matrix_vision/mvblx/sys_eeprom.c: fix buffer overflow

Wolfgang Denk wd at denx.de
Thu Nov 6 14:03:02 CET 2014


Fix error detected by cppcheck:

[board/matrix_vision/mvblx/sys_eeprom.c:353]: (error) Buffer is
accessed out of bounds.

Signed-off-by: Wolfgang Denk <wd at denx.de>
cc: Michael Jones <michael.jones at matrix-vision.de>
---
 board/matrix_vision/mvblx/sys_eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/matrix_vision/mvblx/sys_eeprom.c b/board/matrix_vision/mvblx/sys_eeprom.c
index 1a2ac8d..db42987 100644
--- a/board/matrix_vision/mvblx/sys_eeprom.c
+++ b/board/matrix_vision/mvblx/sys_eeprom.c
@@ -348,7 +348,7 @@ int mac_read_from_eeprom(void)
 
 	if (memcmp(&e.mac, "\0\0\0\0\0\0", 6) &&
 		memcmp(&e.mac, "\xFF\xFF\xFF\xFF\xFF\xFF", 6)) {
-		char ethaddr[9];
+		char ethaddr[18];
 
 		sprintf(ethaddr, "%02X:%02X:%02X:%02X:%02X:%02X",
 			e.mac[0],
-- 
1.8.3.1



More information about the U-Boot mailing list