From 61704169cbf2756b2ea084a0ecfdc8cf34f5cc75 Mon Sep 17 00:00:00 2001 From: Andrei Rusu Date: Wed, 21 Sep 2022 11:42:03 +0300 Subject: logstorage: Truncate ECUid in Logstorage filter to prevent crash (#402) Signed-off-by: Andrei-Mircea Rusu Signed-off-by: Andrei-Mircea Rusu Co-authored-by: Andrei-Mircea Rusu --- src/offlinelogstorage/dlt_offline_logstorage.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c index 07d09a5..a03a861 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage.c +++ b/src/offlinelogstorage/dlt_offline_logstorage.c @@ -498,7 +498,7 @@ DLT_STATIC void dlt_logstorage_create_keys_only_ctid(char *ecuid, char *ctid, int curr_len = 0; if (ecuid != NULL) { - strncpy(curr_str, ecuid, strlen(ecuid)); + strncpy(curr_str, ecuid, DLT_ID_SIZE); strncat(curr_str, "::", 2); } else { @@ -530,7 +530,7 @@ DLT_STATIC void dlt_logstorage_create_keys_only_apid(char *ecuid, char *apid, int curr_len = 0; if (ecuid != NULL) { - strncpy(curr_str, ecuid, strlen(ecuid)); + strncpy(curr_str, ecuid, DLT_ID_SIZE); strncat(curr_str, ":", 1); } else { @@ -564,7 +564,7 @@ DLT_STATIC void dlt_logstorage_create_keys_multi(char *ecuid, char *apid, int curr_len = 0; if (ecuid != NULL) { - strncpy(curr_str, ecuid, strlen(ecuid)); + strncpy(curr_str, ecuid, DLT_ID_SIZE); strncat(curr_str, ":", 1); } else { @@ -595,7 +595,7 @@ DLT_STATIC void dlt_logstorage_create_keys_only_ecu(char *ecuid, char *key) { char curr_str[DLT_OFFLINE_LOGSTORAGE_MAX_KEY_LEN + 1] = { 0 }; - strncpy(curr_str, ecuid, strlen(ecuid)); + strncpy(curr_str, ecuid, DLT_ID_SIZE); strncat(curr_str, "::", 2); strncpy(key, curr_str, strlen(curr_str)); -- cgit v1.2.1