From a871577d9147e2e0b1e408c15f07527bdeda2c39 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Mon, 25 Jul 2016 16:14:25 -0600 Subject: [PATCH] UPSTREAM: 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. BUG=None BRANCH=None TEST=None Change-Id: Iaf9e8ed36d1a689bff4a40593e2bb075d3298353 Signed-off-by: Martin Roth Reviewed-on: https://review.coreboot.org/15889 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Paul Menzel Reviewed-on: https://chromium-review.googlesource.com/365314 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh --- 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 fa4d604a42..44c27fb8fa 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,