stemodem: Quiet warning about strncpy use

This commit is contained in:
Denis Kenzior 2019-05-16 15:10:09 -05:00
parent 90758c5ffc
commit 4b8cc2fcac
2 changed files with 3 additions and 2 deletions

View File

@ -85,7 +85,7 @@ static void parse_newlink_param(struct ifinfomsg *msg, int size,
if (attr->rta_type == IFLA_IFNAME &&
ifname != NULL) {
strncpy(ifname, RTA_DATA(attr), IF_NAMESIZE);
strncpy(ifname, RTA_DATA(attr), IF_NAMESIZE - 1);
ifname[IF_NAMESIZE-1] = '\0';
break;
}

View File

@ -29,6 +29,7 @@
#include <stdio.h>
#include <errno.h>
#include <ell/ell.h>
#include <glib.h>
#include <ofono/log.h>
@ -147,7 +148,7 @@ static void rtnl_callback(int ifindex, const char *ifname, void *user_data)
return;
}
strncpy(gcd->interface, ifname, sizeof(gcd->interface));
l_strlcpy(gcd->interface, ifname, sizeof(gcd->interface));
gcd->ifindex = ifindex;
gcd->created = TRUE;
}