summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesus Sanchez-Palencia <forgerbr@gmail.com>2018-09-25 02:31:17 -0700
committerChristoph Lipka <clipka@users.noreply.github.com>2018-09-25 11:31:17 +0200
commit2659d3b3afe07942263a78ac907ac814de3032b9 (patch)
tree06bb3e48d68396d97a28217e9099ec88de521ee7 /src
parente1560eba378d1916a0a4eba2a54c9085fed49703 (diff)
downloadDLT-daemon-2659d3b3afe07942263a78ac907ac814de3032b9.tar.gz
Fix gcc 8 build (#74)
* dlt-control-common: Fix build with GCC 8: When the "stringop-truncation" warning is treated as an error, the build fails with the following message: * dlt-control-common.c:213:29: error: ‘strncpy’ output may be truncated copying 255 bytes from a string of length 1023 [-Werror=stringop-truncation] On this file we want to truncate the string due to the destination buffer size, so fix the above by using memcpy() instead. * dlt-logstorage-common: Fix build with GCC 8: When the "stringop-truncation" warning is treated as an error, the build fails with the following message: * dlt-logstorage-common.c:313:5: error: ‘strncpy’ specified bound 1024 equals destination size [-Werror=stringop-truncation] In order to avoid truncating and leaving the '\0' byte out, reduce the bound by 1 byte. * systemd/3rdparty: Fix sd-daemon build with GCC 8: When the "stringop-truncation" warning is treated as an error, the build fails with the following message: * sd-daemon.c:453:9: error: ‘strncpy’ specified bound 108 equals destination size. In order to avoid truncating and leaving the '\0' byte out, reduce the bound by 1 byte. Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/console/dlt-control-common.c2
-rw-r--r--src/console/logstorage/dlt-logstorage-common.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c
index 56a1795..d299c6d 100644
--- a/src/console/dlt-control-common.c
+++ b/src/console/dlt-control-common.c
@@ -210,7 +210,7 @@ int dlt_parse_config_param(char *config_id, char **config_data)
{
*(config_data) = (char*)
calloc(DLT_DAEMON_FLAG_MAX, sizeof(char));
- strncpy(*config_data,
+ memcpy(*config_data,
value,
DLT_DAEMON_FLAG_MAX-1);
}
diff --git a/src/console/logstorage/dlt-logstorage-common.c b/src/console/logstorage/dlt-logstorage-common.c
index 9f472d2..ae67c9a 100644
--- a/src/console/logstorage/dlt-logstorage-common.c
+++ b/src/console/logstorage/dlt-logstorage-common.c
@@ -310,7 +310,7 @@ static DltControlMsgBody *prepare_message_body(DltControlMsgBody **body,
/* mount_point is DLT_MOUNT_PATH_MAX + 1 long,
* and the memory is already zeroed.
*/
- strncpy(serv->mount_point, path, DLT_MOUNT_PATH_MAX);
+ strncpy(serv->mount_point, path, DLT_MOUNT_PATH_MAX-1);
pr_verbose("Body is now ready.\n");