From d031e68676e9c0f6272b91adfe2614ce2fec556d Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Fri, 22 Sep 2023 08:40:27 +0000 Subject: [PATCH] i#3544 RV64: Fix read_cache_line For file size less than 8 bytes, using an uninitialized byte array may cause error, returning a cache line size that is wrong and too large. --- core/arch/riscv64/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/arch/riscv64/proc.c b/core/arch/riscv64/proc.c index 86e05d63baa..d93b1169a86 100644 --- a/core/arch/riscv64/proc.c +++ b/core/arch/riscv64/proc.c @@ -48,7 +48,7 @@ static int num_opmask_registers; static size_t read_cache_line(const char *fname) { - char b[sizeof(uint64)], tmp; + char b[sizeof(uint64)] = { 0 }, tmp; size_t res = 0; ssize_t n, i; file_t f;