From 0b37fc0b17aa4dcf02c95d5d6abf971cfedc82a8 Mon Sep 17 00:00:00 2001 From: "Liu, Xinwu" Date: Thu, 25 Apr 2019 12:40:22 +0800 Subject: [PATCH] tools:acrn-crashlog: fix the compiling error on gcc version 9.0.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Meet compiling error: In function ‘strncpy’, inlined from ‘main’ at main.c:88:4: /usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 4096 equals destination size [-Werror=stringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors This patch aims to fix it. Tracked-On: #1024 Signed-off-by: Liu, Xinwu Acked-by: Chen, Gang --- tools/acrn-crashlog/acrnprobe/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/acrn-crashlog/acrnprobe/main.c b/tools/acrn-crashlog/acrnprobe/main.c index e5aad5c79..be4789990 100644 --- a/tools/acrn-crashlog/acrnprobe/main.c +++ b/tools/acrn-crashlog/acrnprobe/main.c @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) NULL)) != -1) { switch (op) { case 'c': - strncpy(cfg, optarg, PATH_MAX); + strncpy(cfg, optarg, PATH_MAX - 1); break; case 'h': usage();