mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-09 02:24:45 +00:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user