core: Fix compiler warning from wrong array size
diff --git a/src/adapter.c b/src/adapter.c
index 390216a..af340fd 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -750,10 +750,10 @@
static int set_name(struct btd_adapter *adapter, const char *name)
{
struct mgmt_cp_set_local_name cp;
- char maxname[MAX_NAME_LENGTH + 1];
+ char maxname[MAX_NAME_LENGTH];
memset(maxname, 0, sizeof(maxname));
- strncpy(maxname, name, MAX_NAME_LENGTH);
+ strncpy(maxname, name, MAX_NAME_LENGTH - 1);
if (!g_utf8_validate(maxname, -1, NULL)) {
btd_error(adapter->dev_id,
diff --git a/src/systemd.c b/src/systemd.c
index cf3da1c..0a4b35d 100644
--- a/src/systemd.c
+++ b/src/systemd.c
@@ -72,7 +72,7 @@
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, sock, sizeof(addr.sun_path));
+ strncpy(addr.sun_path, sock, sizeof(addr.sun_path) - 1);
if (addr.sun_path[0] == '@')
addr.sun_path[0] = '\0';