Browse code

core: use memcpy and set end of string

(cherry picked from commit 5cd4e817a24308b82fc3f631fb18f354dadf2b7e)

Daniel-Constantin Mierla authored on 08/07/2022 09:14:27
Showing 1 changed files
... ...
@@ -1502,7 +1502,8 @@ static int build_iface_list(void)
1502 1502
 			}
1503 1503
 
1504 1504
 			if(strlen(ifaces[index].name)==0 && strlen(name)>0) {
1505
-				strncpy(ifaces[index].name, name, MAX_IF_LEN-1);
1505
+				memcpy(ifaces[index].name, name, MAX_IF_LEN-1);
1506
+				ifaces[index].name[MAX_IF_LEN-1] = '\0';
1506 1507
 			}
1507 1508
 
1508 1509
 			ifaces[index].index = index;