tools: acrn-crashlog: Fix potential issues for load_conf module of acrnprobe

This patch is to fix potential issues, which are reported by static
analysis tool, for load_conf module of acrnprobe.

Changes:
1. Check the range of id while loading configuration, to avoid
   memory corruption.
2. Use strncpy instead of strcpy to avoid buf overflow.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This commit is contained in:
xiaojin2
2018-06-08 13:11:17 +08:00
committed by lijinxia
parent b3ca8f43ff
commit 0c39b9cddc
3 changed files with 220 additions and 83 deletions

View File

@@ -200,7 +200,7 @@ struct conf_t conf;
}) \
)
int load_conf(char *path);
int load_conf(const char *path);
struct trigger_t *get_trigger_by_name(char *name);
struct log_t *get_log_by_name(char *name);
int sender_id(struct sender_t *sender);