From 2ee489d7ef5b653c50522a8dad699eee622078ab Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Tue, 31 Mar 2020 15:32:10 +0200 Subject: spi25.c: Add a null check Change-Id: I5fcc23d81b8404af90768afa2954509bf334ab2c Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/flashrom/+/39974 Reviewed-by: HAOUAS Elyes Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- spi25.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spi25.c b/spi25.c index c774f9917..16d7f1b1d 100644 --- a/spi25.c +++ b/spi25.c @@ -570,6 +570,8 @@ static int spi_write_cmd(struct flashctx *const flash, const uint8_t op, msg_cerr("%s called for too long a write\n", __func__); return 1; } + if (!out_bytes && out_len > 0) + return 1; memcpy(cmd + 1 + addr_len, out_bytes, out_len); cmds[1].writecnt = 1 + addr_len + out_len; -- cgit v1.2.3