From 02c0ed2de7ea059bc37a506c1116c200070dd90e Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 9 Nov 2021 14:04:40 +0100 Subject: [PATCH] bios/boot: Fix memcpy exceeding length (Thanks @acathla). --- litex/soc/software/bios/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 8560c0fe8..7a7b3b76f 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -260,7 +260,7 @@ int serialboot(void) /* Copy payload */ load_addr = (char *)(uintptr_t) get_uint32(&frame.payload[0]); - memcpy(load_addr, &frame.payload[4], frame.payload_length); + memcpy(load_addr, &frame.payload[4], frame.payload_length - 4); /* Acknowledge and continue */ uart_write(SFL_ACK_SUCCESS);