Fix array out of bounds write

Fix #11328
master
Guido Berhoerster 2017-06-08 11:01:34 +02:00 committed by Romain B
parent 3c94964347
commit 011a2ca9ee
1 changed files with 2 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include <libxfce4util/libxfce4util.h> #include <libxfce4util/libxfce4util.h>
/* From Wormulon */ /* From Wormulon */
#include "net.h" #include "net.h"
#include "os.h" #include "os.h"
@ -81,8 +82,7 @@ int init_netload(netdata* data, const char* device)
return TRUE; return TRUE;
} }
strncpy( data->ifdata.if_name, device, INTERFACE_NAME_LENGTH); g_strlcpy(data->ifdata.if_name, device, sizeof(data->ifdata.if_name));
data->ifdata.if_name[INTERFACE_NAME_LENGTH] = '\0';
init_osspecific( data ); init_osspecific( data );