diff options
Diffstat (limited to 'src/daemon/dlt_daemon_common.c')
-rw-r--r-- | src/daemon/dlt_daemon_common.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c index 195c55f..d96d8f2 100644 --- a/src/daemon/dlt_daemon_common.c +++ b/src/daemon/dlt_daemon_common.c @@ -481,12 +481,8 @@ DltDaemonApplication *dlt_daemon_application_add(DltDaemon *daemon, application->application_description = malloc(strlen(description) + 1); if (application->application_description) { - strncpy(application->application_description, - description, - strlen(description)); - application->application_description[strlen(description)] = '\0'; - } - else { + memcpy(application->application_description, description, strlen(description) + 1); + } else { dlt_log(LOG_ERR, "Cannot allocate memory to store application description\n"); free(application); return (DltDaemonApplication *)NULL; @@ -874,8 +870,7 @@ DltDaemonContext *dlt_daemon_context_add(DltDaemon *daemon, context->context_description = malloc(strlen(description) + 1); if (context->context_description) { - strncpy(context->context_description, description, strlen(description)); - context->context_description[strlen(description)] = '\0'; + memcpy(context->context_description, description, strlen(description) + 1); } } |