diff options
Diffstat (limited to 'tools/lib/bpf/xsk.c')
-rw-r--r-- | tools/lib/bpf/xsk.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index b33740221b7e..5007b5d4fd2c 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c | |||
@@ -517,7 +517,8 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, | |||
517 | err = -errno; | 517 | err = -errno; |
518 | goto out_socket; | 518 | goto out_socket; |
519 | } | 519 | } |
520 | strncpy(xsk->ifname, ifname, IFNAMSIZ); | 520 | strncpy(xsk->ifname, ifname, IFNAMSIZ - 1); |
521 | xsk->ifname[IFNAMSIZ - 1] = '\0'; | ||
521 | 522 | ||
522 | err = xsk_set_xdp_socket_config(&xsk->config, usr_config); | 523 | err = xsk_set_xdp_socket_config(&xsk->config, usr_config); |
523 | if (err) | 524 | if (err) |