summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9a6f36c)
Based on patch by Michael Marineau <michael.marineau@coreos.com>:
When deriving the network interface name from machine name strncpy was
not properly null terminating the string and the maximum string size as
returned by strlen() is actually IFNAMSIZ-1, not IFNAMSIZ.
/* Use two different interface name prefixes depending whether
* we are in bridge mode or not. */
/* Use two different interface name prefixes depending whether
* we are in bridge mode or not. */
- if (arg_network_bridge)
- memcpy(iface_name, "vb-", 3);
- else
- memcpy(iface_name, "ve-", 3);
- strncpy(iface_name+3, arg_machine, IFNAMSIZ - 3);
+ snprintf(iface_name, IFNAMSIZ, "%s-%s",
+ arg_network_bridge ? "vb" : "ve", arg_machine);
r = get_mac(&mac);
if (r < 0) {
r = get_mac(&mac);
if (r < 0) {