Browse code

core: use memcpy and set end of string

(cherry picked from commit 5cd4e817a24308b82fc3f631fb18f354dadf2b7e)
(cherry picked from commit ca1e61ec0453b9a4797ac7af88ac179d27e53685)
(cherry picked from commit 5e27edf4dfa1f2dbed8c69c08c6ae8e0f927af2d)

Daniel-Constantin Mierla authored on 08/07/2022 09:14:27
Showing 1 changed files
... ...
@@ -1282,7 +1282,8 @@ static int build_iface_list(void)
1282 1282
 			}
1283 1283
 
1284 1284
 			if(strlen(ifaces[index].name)==0 && strlen(name)>0) {
1285
-				strncpy(ifaces[index].name, name, MAX_IF_LEN-1);
1285
+				memcpy(ifaces[index].name, name, MAX_IF_LEN-1);
1286
+				ifaces[index].name[MAX_IF_LEN-1] = '\0';
1286 1287
 			}
1287 1288
 
1288 1289
 			ifaces[index].index = index;