chiark / gitweb /
nspawn: don't try to create veth link with too long ifname
authorTom Gundersen <teg@jklm.no>
Fri, 19 Sep 2014 21:02:00 +0000 (23:02 +0200)
committerTom Gundersen <teg@jklm.no>
Fri, 19 Sep 2014 21:02:00 +0000 (23:02 +0200)
Reported by: James Lott <james@lottspot.com>

src/nspawn/nspawn.c

index 5af89c9b3238560e064d51fff46795ddb2a8e4bd..c22d0cb59806338e4720a519e299e603706329e4 100644 (file)
@@ -1657,7 +1657,7 @@ static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) {
 
         /* Use two different interface name prefixes depending whether
          * we are in bridge mode or not. */
-        snprintf(iface_name, IFNAMSIZ, "%s-%s",
+        snprintf(iface_name, IFNAMSIZ - 1, "%s-%s",
                  arg_network_bridge ? "vb" : "ve", arg_machine);
 
         r = generate_mac(&mac_container, CONTAINER_HASH_KEY);