diff options
author | Andrei Rusu <andrew_x_2005@yahoo.com> | 2022-09-21 11:42:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 10:42:03 +0200 |
commit | 61704169cbf2756b2ea084a0ecfdc8cf34f5cc75 (patch) | |
tree | bea1718246e378894167eed2649be3fd32e475fc | |
parent | 995ba51c3d0ee88b191e0153b1cc1fc3149f87df (diff) | |
download | DLT-daemon-61704169cbf2756b2ea084a0ecfdc8cf34f5cc75.tar.gz |
logstorage: Truncate ECUid in Logstorage filter to prevent crash (#402)
Signed-off-by: Andrei-Mircea Rusu <andrei-mircea.rusu@continental-corporation.com>
Signed-off-by: Andrei-Mircea Rusu <andrei-mircea.rusu@continental-corporation.com>
Co-authored-by: Andrei-Mircea Rusu <andrei-mircea.rusu@continental-corporation.com>
-rw-r--r-- | src/offlinelogstorage/dlt_offline_logstorage.c | 8 |
1 files changed, 4 insertions, 4 deletions
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)); |