tools: acrn-crashlog: update string operation in acrnprobe

Remove unsafe api strlen except the parameter is a static string.

Tracked-On: #1254
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This commit is contained in:
Liu, Xinwu
2018-09-26 15:23:41 +08:00
committed by Xie, Nanlin
parent 6938caa25f
commit f25bc50e68
9 changed files with 238 additions and 193 deletions

View File

@@ -199,7 +199,8 @@ void hist_raise_uptime(char *lastuptime)
loop_uptime_event = (hours / uptime_hours) + 1;
key = generate_event_id((const char *)uptime->name,
NULL, KEY_SHORT);
uptime->name_len,
NULL, 0, KEY_SHORT);
if (key == NULL) {
LOGE("generate event id failed, error (%s)\n",
strerror(errno));
@@ -213,11 +214,11 @@ void hist_raise_uptime(char *lastuptime)
}
}
void hist_raise_infoerror(char *type)
void hist_raise_infoerror(const char *type, size_t tlen)
{
char *key;
key = generate_event_id("ERROR", (const char *)type, KEY_SHORT);
key = generate_event_id("ERROR", 5, type, tlen, KEY_SHORT);
if (key == NULL) {
LOGE("generate event id failed, error (%s)\n",
strerror(errno));