>For this reason, force both strings to use IFNAMSIZ as size and, since >this constant may not exist on every platform, ensure it is always >defined. A problem with this patch misght be that strncpy() does NOT NUL terminates the copied string. (It writes EXACTLY IFNAMSIZ bytes but only when the string is shorter, it will writes NUL bytes in the reminder of the char array[].) You could use strlcpy() but I'm not sure if that is available in Windows. > > /* save result in output variables */ > memcpy(best_gw, &res.gw, res.addr_size); - strcpy(best_iface, res.iface); >+ strncpy(best_iface, res.iface, IFNAMSIZ); Casper _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Re: [Openvpn-devel] [PATCH 1/6] sitnl: harden strncpy() by forcing arguments to have the same length
- [Openvpn-devel] [PATCH 0/6] sitnl follow-up Antonio Quartulli
- [Openvpn-devel] [PATCH 1/6] sitnl: harden strncpy()... Antonio Quartulli
- Re: [Openvpn-devel] [PATCH 1/6] sitnl: harden s... Casper . Dik
- Re: [Openvpn-devel] [PATCH 1/6] sitnl: hard... Antonio Quartulli
- [Openvpn-devel] [PATCH applied] Re: sitnl: hard... Gert Doering
- [Openvpn-devel] [PATCH 3/6] networking: extend API ... Antonio Quartulli
- Re: [Openvpn-devel] [PATCH 3/6] networking: ext... Gert Doering
- [Openvpn-devel] [PATCH v2] networking: exte... Antonio Quartulli
- [Openvpn-devel] [PATCH applied] Re: net... Gert Doering
- [Openvpn-devel] [PATCH 6/6] route.c: simplify ifdef... Antonio Quartulli
- [Openvpn-devel] [PATCH applied] Re: route.c: si... Gert Doering
- [Openvpn-devel] [PATCH 2/6] networking/best_gw: rem... Antonio Quartulli
- [Openvpn-devel] [PATCH applied] Re: networking/... Gert Doering