From 68299ee7a44f1b43cd49a2317324eadb6616e330 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Fri, 23 Dec 2011 18:45:33 -0700 Subject: Eliminate magic numbers Use sizeof() on vendor and part# rather than explicit memory length. Change-Id: I2b7e0e4a8df6448d027cc61867382f161eb990d3 Signed-off-by: Philip Prindeville Reviewed-on: http://review.coreboot.org/504 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- payloads/coreinfo/coreboot_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'payloads/coreinfo') diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c index d33ea9ee6021..77a4bb2d8b65 100644 --- a/payloads/coreinfo/coreboot_module.c +++ b/payloads/coreinfo/coreboot_module.c @@ -142,8 +142,8 @@ static void parse_mainboard(unsigned char *ptr) { struct cb_mainboard *mb = (struct cb_mainboard *)ptr; - strncpy(cb_info.vendor, cb_mb_vendor_part(mb), 31); - strncpy(cb_info.part, cb_mb_part_string(mb), 31); + strncpy(cb_info.vendor, cb_mb_vendor_part(mb), sizeof(cb_info.vendor) - 1); + strncpy(cb_info.part, cb_mb_part_string(mb), sizeof(cb_info.part) - 1); } static void parse_strings(unsigned char *ptr) -- cgit v1.2.3