lib:socket: fix CID 1350009 - illegal memory accesses (BUFFER_SIZE_WARNING)
[samba.git] / lib / socket / interfaces.c
index cf094f0b4c56607ce6ab2f6a7fc8505828409a5c..847fa6255ba74e61a1870c2f5be9a5ed92833919 100644 (file)
@@ -140,6 +140,11 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
                return;
        }
 
+       if (strlen(name) >= IF_NAMESIZE) {
+               DBG_ERR("Interface name too long.");
+               goto done;
+       }
+
        strncpy(ifr.ifr_name, name, IF_NAMESIZE);
 
        ifr.ifr_data = (void *)&edata;