mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-18 20:10:53 +00:00
tapif: fix strncpy
Adjust the strncpy() call in tapif.c to how this is coded in other strncpy() invocations. Also gcc warns about this. See patch #10142
This commit is contained in:
parent
7c3aab2ea2
commit
34e435c786
@ -153,9 +153,9 @@ low_level_init(struct netif *netif)
|
|||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
|
|
||||||
if (preconfigured_tapif) {
|
if (preconfigured_tapif) {
|
||||||
strncpy(ifr.ifr_name, preconfigured_tapif, sizeof(ifr.ifr_name));
|
strncpy(ifr.ifr_name, preconfigured_tapif, sizeof(ifr.ifr_name) - 1);
|
||||||
} else {
|
} else {
|
||||||
strncpy(ifr.ifr_name, DEVTAP_DEFAULT_IF, sizeof(ifr.ifr_name));
|
strncpy(ifr.ifr_name, DEVTAP_DEFAULT_IF, sizeof(ifr.ifr_name) - 1);
|
||||||
}
|
}
|
||||||
ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0; /* ensure \0 termination */
|
ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0; /* ensure \0 termination */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user