From 4d762be98089a4781a937fcbd423f09f939a153a Mon Sep 17 00:00:00 2001 From: Saya Sugiura Date: Tue, 18 Feb 2020 19:45:59 +0900 Subject: logstorage: Add NULL check of IDs There is a missing NULL check for APID and CTID in dlt_logstorage_create_keys() function in following condition: - APID is wildcard - CTID is wildcard - ECUID is set Related commit: 557624f SOPL-8567: daemon: logstorage with wildcards Signed-off-by: Saya Sugiura --- src/offlinelogstorage/dlt_offline_logstorage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c index 948fbee..7bc7bfd 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage.c +++ b/src/offlinelogstorage/dlt_offline_logstorage.c @@ -639,7 +639,8 @@ DLT_STATIC int dlt_logstorage_create_keys(char *apids, /* Handle ecuid alone case here */ if (((apids == NULL) && (ctids == NULL) && (ecuid != NULL)) || - ((strncmp(apids, ".*", 2) == 0) && (strncmp(ctids, ".*", 2) == 0) && (ecuid != NULL)) ) { + ((apids != NULL) && (strncmp(apids, ".*", 2) == 0) && + (ctids != NULL) && (strncmp(ctids, ".*", 2) == 0) && (ecuid != NULL)) ) { dlt_logstorage_create_keys_only_ecu(ecuid, curr_key); *(num_keys) = 1; *(keys) = (char *)calloc(*num_keys * DLT_OFFLINE_LOGSTORAGE_MAX_KEY_LEN, -- cgit v1.2.1