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:
@@ -56,10 +56,10 @@ static void entry_to_history_line(struct history_entry *entry,
|
||||
newline[0] = 0;
|
||||
if (entry->log != NULL) {
|
||||
char *ptr;
|
||||
char tmp[MAXLINESIZE];
|
||||
char tmp[PATH_MAX];
|
||||
|
||||
strncpy(tmp, entry->log, MAXLINESIZE);
|
||||
tmp[MAXLINESIZE-1] = 0;
|
||||
strncpy(tmp, entry->log, PATH_MAX);
|
||||
tmp[PATH_MAX - 1] = 0;
|
||||
ptr = strrchr(tmp, '/');
|
||||
if (ptr && ptr[1] == 0)
|
||||
ptr[0] = 0;
|
||||
|
||||
Reference in New Issue
Block a user