mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 06:01:16 +02:00
serprog.c: Avoid calling memcpy with NULL pointer arguments
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. Still, add a NULL check before calling memcpy to be safe. Change-Id: I850123237e328f9548ba7f77a01888be2cbc9e7b Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/62726 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
7228ce007c
commit
c829a48e19
@ -291,6 +291,7 @@ static int sp_stream_buffer_op(uint8_t cmd, uint32_t parmlen, uint8_t *parms)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sp[0] = cmd;
|
sp[0] = cmd;
|
||||||
|
if (parms)
|
||||||
memcpy(&(sp[1]), parms, parmlen);
|
memcpy(&(sp[1]), parms, parmlen);
|
||||||
|
|
||||||
if (sp_streamed_transmit_bytes >= (1 + parmlen + sp_device_serbuf_size)) {
|
if (sp_streamed_transmit_bytes >= (1 + parmlen + sp_device_serbuf_size)) {
|
||||||
|
Reference in New Issue
Block a user