Skip to content

Instantly share code, notes, and snippets.

@yen3
Created September 6, 2019 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yen3/4ad2dd90cc908b3b7534825241ed9878 to your computer and use it in GitHub Desktop.
Save yen3/4ad2dd90cc908b3b7534825241ed9878 to your computer and use it in GitHub Desktop.
Build dlt-daemon v2.16.0 in debian buster
diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c
index 3973059..84d441c 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..344e162 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");
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 9288d33..97b4586 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -47,7 +47,7 @@
#endif
#include <sys/stat.h>
#include <sys/time.h>
-#ifdef linux
+#if defined(linux) && defined(__NR_statx)
#include <linux/stat.h>
#endif
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index 24be8e4..fdd9108 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -46,7 +46,7 @@
#endif
#include <sys/stat.h>
#include <sys/time.h>
-#ifdef linux
+#if defined(linux) && defined(__NR_statx)
#include <linux/stat.h>
#endif
diff --git a/src/daemon/dlt_daemon_socket.c b/src/daemon/dlt_daemon_socket.c
index 686f4d6..ff77624 100644
--- a/src/daemon/dlt_daemon_socket.c
+++ b/src/daemon/dlt_daemon_socket.c
@@ -49,7 +49,7 @@
#endif
#include <sys/stat.h>
#include <sys/time.h>
-#ifdef linux
+#if defined(linux) && defined(__NR_statx)
#include <linux/stat.h>
#endif
diff --git a/systemd/3rdparty/sd-daemon.c b/systemd/3rdparty/sd-daemon.c
index 763e079..9833136 100644
--- a/systemd/3rdparty/sd-daemon.c
+++ b/systemd/3rdparty/sd-daemon.c
@@ -450,7 +450,7 @@ _sd_export_ int sd_notify(int unset_environment, const char *state) {
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sa.sa_family = AF_UNIX;
- strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
+ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path) - 1);
if (sockaddr.un.sun_path[0] == '@')
sockaddr.un.sun_path[0] = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment