Aarya Chaumal has uploaded this change for review.

View Change

serprog.c: Fixed passed null value when expectingn nonnull

In function sp_stream_buffer_op, the variable parms might be NULL when
passed to memcpy. Although, since parmlen is also 0 at that time I
don't think it would make much difference. Just added a check before
memcpy for parms==NULL.

Change-Id: I850123237e328f9548ba7f77a01888be2cbc9e7b
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
---
M serprog.c
1 file changed, 2 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/26/62726/1
diff --git a/serprog.c b/serprog.c
index 2bbf44b..9ff8109 100644
--- a/serprog.c
+++ b/serprog.c
@@ -291,7 +291,8 @@
return 1;
}
sp[0] = cmd;
- memcpy(&(sp[1]), parms, parmlen);
+ if(parms)
+ 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 62726. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I850123237e328f9548ba7f77a01888be2cbc9e7b
Gerrit-Change-Number: 62726
Gerrit-PatchSet: 1
Gerrit-Owner: Aarya Chaumal <aarya.chaumal@gmail.com>
Gerrit-MessageType: newchange