Ao Zhong has uploaded this change for review.

View Change

Copy parms only if it's not NULL.

The behavior of memcpy is undefined, when the source or destination is a
null pointer. Copy parms only if it's not NULL.

Signed-off-by: Ao Zhong <hacc1225@gmail.com>
Change-Id: I6517b57f62a2b333b7d2d28f69c0c65baa94070a
---
M serprog.c
1 file changed, 2 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/65/63565/1
diff --git a/serprog.c b/serprog.c
index 2bbf44b..27ec40b 100644
--- a/serprog.c
+++ b/serprog.c
@@ -291,7 +291,8 @@
return 1;
}
sp[0] = cmd;
- memcpy(&(sp[1]), parms, parmlen);
+ if (parms != NULL)
+ memcpy(&(sp[1]), parms, parmlen);

if (sp_streamed_transmit_bytes >= (1 + parmlen + sp_device_serbuf_size)) {
if (sp_flush_stream() != 0) {

To view, visit change 63565. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I6517b57f62a2b333b7d2d28f69c0c65baa94070a
Gerrit-Change-Number: 63565
Gerrit-PatchSet: 1
Gerrit-Owner: Ao Zhong <hacc1225@gmail.com>
Gerrit-MessageType: newchange