drivers: Silence strncpy use warnings

This commit is contained in:
Denis Kenzior 2019-04-30 11:11:49 -05:00
parent 614ffb0761
commit 74dc62b148
3 changed files with 15 additions and 12 deletions

View File

@ -27,6 +27,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <ell/ell.h>
#include <glib.h>
#include <ofono/log.h>
@ -233,7 +234,7 @@ static void cpuc_query_cb(gboolean ok,
if (g_at_result_iter_next_string(&iter, &currency) != TRUE)
goto error;
strncpy(currency_buf, currency, sizeof(currency_buf));
l_strlcpy(currency_buf, currency, sizeof(currency_buf));
if (g_at_result_iter_next_string(&iter, &ppu) != TRUE)
goto error;

View File

@ -29,6 +29,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <ell/ell.h>
#include <glib.h>
#include <ofono/log.h>
@ -201,8 +202,8 @@ static void dns_cb(gboolean ok, GAtResult *result, gpointer user_data)
if ((unsigned int) cid == gcd->active_context) {
found = TRUE;
strncpy(gcd->dns1, dns1, sizeof(gcd->dns1));
strncpy(gcd->dns2, dns2, sizeof(gcd->dns2));
l_strlcpy(gcd->dns1, dns1, sizeof(gcd->dns1));
l_strlcpy(gcd->dns2, dns2, sizeof(gcd->dns2));
}
}
@ -251,7 +252,7 @@ static void address_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (!g_at_result_iter_next_string(&iter, &address))
goto error;
strncpy(gcd->address, address, sizeof(gcd->address));
l_strlcpy(gcd->address, address, sizeof(gcd->address));
if (g_at_chat_send(gcd->chat, "AT+XDNS?", xdns_prefix,
dns_cb, gc, NULL) > 0)
@ -347,8 +348,8 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
break;
}
strncpy(gcd->dns1, dns[0], sizeof(gcd->dns1));
strncpy(gcd->dns2, dns[1], sizeof(gcd->dns2));
l_strlcpy(gcd->dns1, dns[0], sizeof(gcd->dns1));
l_strlcpy(gcd->dns2, dns[1], sizeof(gcd->dns2));
dns[2] = 0;
DBG("DNS: %s, %s\n", gcd->dns1, gcd->dns2);
@ -391,7 +392,7 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
}
if (gw)
strncpy(gcd->gateway, gw, sizeof(gcd->gateway));
l_strlcpy(gcd->gateway, gw, sizeof(gcd->gateway));
gcd->state = STATE_ACTIVE;

View File

@ -25,6 +25,7 @@
#include <errno.h>
#include <sys/stat.h>
#include <ell/ell.h>
#include <glib.h>
#include <ofono/log.h>
@ -171,13 +172,13 @@ static void contrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
found = TRUE;
if (strcmp(gcd->address, "") != 0)
strncpy(gcd->netmask,
l_strlcpy(gcd->netmask,
&ip_mask[strlen(gcd->address) + 1],
sizeof(gcd->netmask));
strncpy(gcd->gateway, gw, sizeof(gcd->gateway));
strncpy(gcd->dns1, dns1, sizeof(gcd->dns1));
strncpy(gcd->dns2, dns2, sizeof(gcd->dns2));
l_strlcpy(gcd->gateway, gw, sizeof(gcd->gateway));
l_strlcpy(gcd->dns1, dns1, sizeof(gcd->dns1));
l_strlcpy(gcd->dns2, dns2, sizeof(gcd->dns2));
}
}
@ -229,7 +230,7 @@ static void address_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (!g_at_result_iter_next_string(&iter, &address))
goto error;
strncpy(gcd->address, address, sizeof(gcd->address));
l_strlcpy(gcd->address, address, sizeof(gcd->address));
sprintf(buf, "AT+CGCONTRDP=%d", gcd->active_context);
if (g_at_chat_send(gcd->chat, buf, cgcontrdp_prefix,