diff --git a/config.h b/config.h index 8bcdbc3..306fd48 100644 --- a/config.h +++ b/config.h @@ -25,10 +25,11 @@ #include "transport.h" #define MAX_PORTS 8 +#define MAX_IFNAME_SIZE 16 /** Defines a network interface, with PTP options. */ struct interface { - char *name; + char name[MAX_IFNAME_SIZE + 1]; enum delay_mechanism dm; enum transport_type transport; }; diff --git a/ptp4l.c b/ptp4l.c index 899cc42..8c47ee1 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) break; case 'i': if (*nports < MAX_PORTS) { - iface[*nports].name = optarg; + strncpy(iface[*nports].name, optarg, MAX_IFNAME_SIZE); iface[*nports].dm = *dm; iface[*nports].transport = *transport; (*nports)++;