summaryrefslogtreecommitdiff
path: root/src/daemon/dlt_daemon_common.c
diff options
context:
space:
mode:
authorSimon Brandner <simon.brandner@partner.bmw.de>2012-12-06 10:18:12 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-07-19 16:54:05 +0200
commitbe9c3bf964295883ff086dfb8c2ece38f833b355 (patch)
tree9faf2962efc5b7c24c98f5082d8afd4c2f7a2907 /src/daemon/dlt_daemon_common.c
parent311b8896c144c5ff8c10dbc0d4c7832720292608 (diff)
downloadDLT-daemon-be9c3bf964295883ff086dfb8c2ece38f833b355.tar.gz
appended null termination to version string
adding closure of socket in syslog_thread and read_socket fixed missing free of filepath in compressed file transfer fixed missing closedir in added in send_one error case fixed missing fclose of src_file in ferror case dlt-daemon.c fixed missing fclose in ferror case dlt_common.c using snprintf for filename instead sprintf in dlt_file_open modified some magix numbers - replaced by limits.h values. added strncpy instead strcpy to make cp more safe. split up a function to avoid coverity complaint when computing size of a write buffer length dlt_daemon_common: added strncpy instead strcpy to make cp more safe. Fixes some more Coverity issues in dlt-daemon.c dlt_user.c dlt_common.c and dlt_offline_trace.c. Conflicts: src/daemon/dlt-daemon.c src/lib/dlt_user.c Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/daemon/dlt_daemon_common.c')
-rw-r--r--src/daemon/dlt_daemon_common.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 7bbce7b..2f0e73a 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -125,6 +125,7 @@ int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose
return -1;
}
+ int append_length = 0;
daemon->num_contexts = 0;
daemon->contexts = 0;
@@ -141,18 +142,24 @@ int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose
daemon->mode = DLT_USER_MODE_EXTERNAL;
/* prepare filenames for configuration */
+
+ append_length = PATH_MAX - sizeof(DLT_RUNTIME_APPLICATION_CFG);
if(runtime_directory[0])
- strcpy(daemon->runtime_application_cfg,runtime_directory);
+ strncpy(daemon->runtime_application_cfg,runtime_directory,append_length);
else
strcpy(daemon->runtime_application_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY);
strcat(daemon->runtime_application_cfg,DLT_RUNTIME_APPLICATION_CFG);
+
+ append_length = PATH_MAX - sizeof(DLT_RUNTIME_CONTEXT_CFG);
if(runtime_directory[0])
- strcpy(daemon->runtime_context_cfg,runtime_directory);
+ strncpy(daemon->runtime_context_cfg,runtime_directory,append_length);
else
strcpy(daemon->runtime_context_cfg,DLT_RUNTIME_DEFAULT_DIRECTORY);
strcat(daemon->runtime_context_cfg,DLT_RUNTIME_CONTEXT_CFG);
- if(runtime_directory[0])
- strcpy(daemon->runtime_configuration,runtime_directory);
+
+ append_length = PATH_MAX - sizeof(DLT_RUNTIME_CONFIGURATION);
+ if(runtime_directory[0])
+ strncpy(daemon->runtime_configuration,runtime_directory,append_length);
else
strcpy(daemon->runtime_configuration,DLT_RUNTIME_DEFAULT_DIRECTORY);
strcat(daemon->runtime_configuration,DLT_RUNTIME_CONFIGURATION);