From eab3d321f6beac3153a3a99b5631e5003a93623c Mon Sep 17 00:00:00 2001 From: zhanghaibo Date: Mon, 10 Apr 2023 17:15:23 +0800 Subject: [PATCH] use gnu99 std and fix potential overflow Signed-off-by: zhanghaibo Change-Id: Ied6da97755c78f320ad43213077af6e674bb9d24 --- BUILD.gn | 2 ++ libdwfl/linux-kernel-modules.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index b6a6fa38..66650948 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -20,6 +20,8 @@ config("elfutils_defaults") { "_GNU_SOURCE", "NMNES=1000", ] + + cflags = [ "-std=gnu99" ] } config("elfutils_public_config") { diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index c0f8dfa4..58c0c417 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -1008,7 +1008,7 @@ dwfl_linux_kernel_report_modules (Dwfl *dwfl) int result = 0; Dwarf_Addr modaddr; unsigned long int modsz; - char modname[128]; + char modname[128+1]; char *line = NULL; size_t linesz = 0; /* We can't just use fscanf here because it's not easy to distinguish \n -- Gitee