mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-09 02:24:45 +00:00
tools: acrn-crashlog: fix build warnings with gcc8.1.1
This patch is to fix the build warning with gcc8.1.1. Most of them are warnings for buffer overflow from snprintf and strncpy. Signed-off-by: CHEN Gang <gang.c.chen@intel.com> Reviewed-by: Zhi Jin <zhi.jin@intel.com> Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com> Reviewed-by: xiaojin2 <xiaojing.liu@intel.com>
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#define DUMP_FILE "/tmp/core"
|
||||
#define BUFFER_SIZE 8196
|
||||
#define LINK_LEN 512
|
||||
/* 128 means the length of the DUMP_FILE */
|
||||
#define FORMAT_LENGTH (LINK_LEN + 128)
|
||||
|
||||
static void loginfo(int fd, const char *fmt, ...)
|
||||
{
|
||||
@@ -110,7 +112,7 @@ static int save_coredump(const char *filename)
|
||||
static int get_backtrace(int pid, int fd, int sig, const char *comm)
|
||||
{
|
||||
char *membkt;
|
||||
char format[512];
|
||||
char format[FORMAT_LENGTH];
|
||||
|
||||
loginfo(fd, "\nBackTrace:\n\n");
|
||||
memset(format, 0, sizeof(format));
|
||||
|
||||
Reference in New Issue
Block a user