mirror of https://gerrit.osmocom.org/libosmocore
gprs_ns2_fr.c: compiler error: replace strncpy() with OSMO_STRLCPY_ARRAY()
My gcc (Debian 8.3.0-6) 8.3.0 refuses to build this strncpy() use: it
issues the buffer length as n and thus potentially fails to account for
the terminating nul. The line after that fixes the problem, so it's not
an actual bug. Anyway, we have a policy to never use strncpy(), and have
osmo_strlcpy() and OSMO_STRLCPY_ARRAY() for this.
This strncpy() was introduced last month during first addition of
gprs_ns2_fr.c:
commit 841817ec52
ns2: add support for frame relay
Change-Id Id3b49f93d33c271f77cd9c9db03cde6b727a4d30
Change-Id: I494a6fb7ccd7938a39e8956f73ec4282da38d7fb
This commit is contained in:
parent
6f89c770c7
commit
475a0acc64
|
@ -296,8 +296,7 @@ static int devname2ifindex(const char *ifname)
|
|||
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
|
||||
ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0;
|
||||
OSMO_STRLCPY_ARRAY(ifr.ifr_name, ifname);
|
||||
|
||||
rc = ioctl(sk, SIOCGIFINDEX, &ifr);
|
||||
close(sk);
|
||||
|
|
Loading…
Reference in New Issue