summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dbus/dlt-dbus-options.c6
-rw-r--r--src/dbus/dlt-dbus.h2
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage.c9
-rw-r--r--src/shared/dlt_offline_trace.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/src/dbus/dlt-dbus-options.c b/src/dbus/dlt-dbus-options.c
index fc5b584..d00cdc4 100644
--- a/src/dbus/dlt-dbus-options.c
+++ b/src/dbus/dlt-dbus-options.c
@@ -82,21 +82,21 @@ int read_command_line(DltDBusCliOptions *options, int argc, char *argv[])
{
options->BusType = malloc(strlen(optarg) + 1);
MALLOC_ASSERT(options->BusType);
- strcpy(options->BusType, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
+ strcpy(options->BusType, optarg); /* strcpy uncritical here, because size matches exactly the size to be copied */
break;
}
case 'a':
{
options->ApplicationId = malloc(strlen(optarg) + 1);
MALLOC_ASSERT(options->ApplicationId);
- strcpy(options->ApplicationId, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
+ strcpy(options->ApplicationId, optarg); /* strcpy uncritical here, because size matches exactly the size to be copied */
break;
}
case 'c':
{
options->ConfigurationFileName = malloc(strlen(optarg) + 1);
MALLOC_ASSERT(options->ConfigurationFileName);
- strcpy(options->ConfigurationFileName, optarg); /* strcpy unritical here, because size matches exactly the size to be copied */
+ strcpy(options->ConfigurationFileName, optarg); /* strcpy uncritical here, because size matches exactly the size to be copied */
break;
}
case 'h':
diff --git a/src/dbus/dlt-dbus.h b/src/dbus/dlt-dbus.h
index 6f553d9..05bddf1 100644
--- a/src/dbus/dlt-dbus.h
+++ b/src/dbus/dlt-dbus.h
@@ -31,7 +31,7 @@
#include "dlt.h"
#include "dlt_common.h"
-#define DEFAULT_CONF_FILE "/etc/dlt-dbus.conf"
+#define DEFAULT_CONF_FILE CONFIGURATION_FILES_DIR "/dlt-dbus.conf"
#define DLT_DBUS_FILTER_MAX 32
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c
index fe1af71..0eda630 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage.c
@@ -357,7 +357,7 @@ DLT_STATIC int dlt_logstorage_read_list_of_names(char **names, char *value)
strncpy((*names + y), tok, len);
if ((num > 1) && (i < num))
- strncpy((*names + y + len), ",", 1);
+ strncpy((*names + y + len), ",", 2);
y += len + 1;
@@ -1554,7 +1554,7 @@ DLT_STATIC int dlt_logstorage_store_filters(DltLogStorage *handle,
*/
DLT_STATIC int dlt_logstorage_load_config(DltLogStorage *handle)
{
- char config_file_name[PATH_MAX + 1] = { '\0' };
+ char config_file_name[PATH_MAX] = {0};
int ret = 0;
/* Check if handle is NULL or already initialized or already configured */
@@ -1579,7 +1579,7 @@ DLT_STATIC int dlt_logstorage_load_config(DltLogStorage *handle)
"Creating configuration file path string failed\n");
return -1;
}
-
+ config_file_name[PATH_MAX - 1] = 0;
ret = dlt_logstorage_store_filters(handle, config_file_name);
if (ret == 1) {
@@ -1624,6 +1624,7 @@ int dlt_logstorage_device_connected(DltLogStorage *handle, char *mount_point)
}
strncpy(handle->device_mount_point, mount_point, DLT_MOUNT_PATH_MAX);
+ handle->device_mount_point[DLT_MOUNT_PATH_MAX] = 0;
handle->connection_type = DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED;
handle->config_status = 0;
handle->write_errors = 0;
@@ -1653,7 +1654,7 @@ int dlt_logstorage_device_disconnected(DltLogStorage *handle, int reason)
dlt_logstorage_free(handle, reason);
/* Reset all device status */
- memset(handle->device_mount_point, '\0', sizeof(char) * DLT_MOUNT_PATH_MAX);
+ memset(handle->device_mount_point, 0, sizeof(char) * (DLT_MOUNT_PATH_MAX + 1));
handle->connection_type = DLT_OFFLINE_LOGSTORAGE_DEVICE_DISCONNECTED;
handle->config_status = 0;
handle->write_errors = 0;
diff --git a/src/shared/dlt_offline_trace.c b/src/shared/dlt_offline_trace.c
index 8049495..6a7a884 100644
--- a/src/shared/dlt_offline_trace.c
+++ b/src/shared/dlt_offline_trace.c
@@ -143,7 +143,7 @@ unsigned int dlt_offline_trace_storage_dir_info(char *path, char *file_name, cha
void dlt_offline_trace_file_name(char *log_file_name, char *name, unsigned int idx)
{
char file_index[11]; /* UINT_MAX = 4294967295 -> 10 digits */
- sprintf(file_index, "%010u", idx);
+ snprintf(file_index, sizeof(file_index), "%010u", idx);
/* create log file name */
memset(log_file_name, 0, DLT_OFFLINETRACE_FILENAME_MAX_SIZE * sizeof(char));