Преглед изворни кода

core: use memcpy and set end of string

Daniel-Constantin Mierla пре 3 година
родитељ
комит
5cd4e817a2
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      src/core/socket_info.c

+ 2 - 1
src/core/socket_info.c

@@ -1551,7 +1551,8 @@ static int build_iface_list(void)
 			}
 
 			if(strlen(ifaces[index].name)==0 && strlen(name)>0) {
-				strncpy(ifaces[index].name, name, MAX_IF_LEN-1);
+				memcpy(ifaces[index].name, name, MAX_IF_LEN-1);
+				ifaces[index].name[MAX_IF_LEN-1] = '\0';
 			}
 
 			ifaces[index].index = index;