Re: [OpenWrt-Devel] [PATCH] make sure strings will always be 0-terminated.

2012-12-08 Thread Justin Vallon
On 12/6/12 1:18 AM, Frank Meerkötter wrote: @@ -345,7 +345,7 @@ int system_bridge_delif(struct device *bridge, struct device *dev) static int system_if_resolve(struct device *dev) { struct ifreq ifr; - strncpy(ifr.ifr_name, dev-ifname, sizeof(ifr.ifr_name)); +

Re: [OpenWrt-Devel] [PATCH] make sure strings will always be 0-terminated.

2012-12-08 Thread Florian Fainelli
Le 08/12/2012 16:14, Justin Vallon a écrit : On 12/6/12 1:18 AM, Frank Meerkötter wrote: @@ -345,7 +345,7 @@ int system_bridge_delif(struct device *bridge, struct device *dev) static int system_if_resolve(struct device *dev) { struct ifreq ifr; -strncpy(ifr.ifr_name, dev-ifname,

[OpenWrt-Devel] [PATCH] make sure strings will always be 0-terminated.

2012-12-05 Thread Frank Meerkötter
From the man page: [...] The strncpy() function is similar, except that at most n bytes of src are copied. Warning: If there is no null byte among the first n bytes of src, the string placed in dest will not be null-terminated. [...] Signed-off-by: Frank Meerkötter