[coreboot-gerrit] New patch to review for coreboot: intel/common/opregion.c: only write 16 bytes to 16 byte field

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Tue Jul 26 00:16:30 CEST 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15889

-gerrit

commit 67f2e0cd5ecb1c5d7ac6bf4bbcfd0cf00db15742
Author: Martin Roth <martinroth at google.com>
Date:   Mon Jul 25 16:14:25 2016 -0600

    intel/common/opregion.c: only write 16 bytes to 16 byte field
    
    Including the terminating null, 17 characters were being written to the
    field, overwriting the a byte of the size field.
    
    Fortunately, the size was updated soon after this.
    
    Fixes coverity warning 1229570 - Destination buffer too small.
    
    Change-Id: I39285a9283dd9a17d638afe5b2755c7e420d7698
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 src/soc/intel/common/opregion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/soc/intel/common/opregion.c b/src/soc/intel/common/opregion.c
index fa4d604..44c27fb 100644
--- a/src/soc/intel/common/opregion.c
+++ b/src/soc/intel/common/opregion.c
@@ -40,7 +40,7 @@ int init_igd_opregion(igd_opregion_t *opregion)
 	memset(opregion, 0, sizeof(igd_opregion_t));
 
 	memcpy(&opregion->header.signature, IGD_OPREGION_SIGNATURE,
-					sizeof(IGD_OPREGION_SIGNATURE));
+					sizeof(opregion->header.signature));
 	memcpy(opregion->header.vbios_version, vbt->coreblock_biosbuild,
 					ARRAY_SIZE(vbt->coreblock_biosbuild));
 	memcpy(opregion->vbt.gvd1, vbt, MIN(vbt->hdr_vbt_size,



More information about the coreboot-gerrit mailing list