[coreboot-gerrit] New patch to review for coreboot: soc/intel/common: Pass the minimum possible string length for strncpy
Barnali Sarkar (barnali.sarkar@intel.com)
gerrit at coreboot.org
Tue Mar 7 12:53:13 CET 2017
Barnali Sarkar (barnali.sarkar at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18617
-gerrit
commit 3fdb57846ee6eff539d8dfdfaf052f914b5d5bfa
Author: Barnali Sarkar <barnali.sarkar at intel.com>
Date: Tue Mar 7 17:11:03 2017 +0530
soc/intel/common: Pass the minimum possible string length for strncpy
In strncpy() function of dimm_info_fill(), the minimum possible size
of Module Part Number of DIMM is passed as argument.
BUG=chrome-os-partner:61729
BRANCH=none
TEST=Build and boot KBLRVP to verify the type 17 DIMM info coming in
SMBIOS Table from Kernel command "dmidecode".
Change-Id: Icc7667149eae9705b91e271628af1b443eb8556e
Signed-off-by: Barnali Sarkar <barnali.sarkar at intel.com>
---
src/soc/intel/common/smbios.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/soc/intel/common/smbios.c b/src/soc/intel/common/smbios.c
index 3aee9ff..821ecaa 100644
--- a/src/soc/intel/common/smbios.c
+++ b/src/soc/intel/common/smbios.c
@@ -30,7 +30,7 @@ void dimm_info_fill(struct dimm_info *dimm, u32 dimm_capacity, u8 ddr_type,
dimm->dimm_num = dimm_id;
strncpy((char *)dimm->module_part_number,
module_part_num,
- sizeof(dimm->module_part_number));
+ min(sizeof(dimm->module_part_number), strlen(module_part_num)));
switch (data_width) {
case 8:
dimm->bus_width = MEMORY_BUS_WIDTH_8;
More information about the coreboot-gerrit
mailing list