Skip to content

Commit

Permalink
logstorage: Truncate ECUid in Logstorage filter to prevent crash (#402)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei-Mircea Rusu <[email protected]>

Signed-off-by: Andrei-Mircea Rusu <[email protected]>
Co-authored-by: Andrei-Mircea Rusu <[email protected]>
  • Loading branch information
andreirusu96 and Andrei-Mircea Rusu authored Sep 21, 2022
1 parent 995ba51 commit 6170416
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/offlinelogstorage/dlt_offline_logstorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 6170416

Please sign in to comment.