-
Thomas Haller authored
Always ensure that the entire buffer is initialized with padding NULs. For example, valgrind checks whether we access uninitalized memory, so leaving this uninitalized can be unexpected and cause valgrind failures. In general, one might be tempted to copy the ifname buffer (of well known size IFNAMSIZ) with memcpy(). In that case, we should not have trailing garbage there. We could use strncpy() for that (which guarantees NUL padding), but then we still would have to ensure NUL termination. But strncpy() is frowned upon, so let's not use it here. Note that g_strlcpy() does not guarantee NUL padding, so it's unsuitable. We could also implement this with a combination of memcpy() and memset(). But in this case, it just seems simpler to iterate over the 16 bytes and do it manually.
98f41226