--- ./panel-plugin/wormulon/openbsd.c-orig Thu Feb 9 14:42:29 2017 +++ ./panel-plugin/wormulon/openbsd.c Tue Sep 12 18:25:33 2017 @@ -108,7 +108,7 @@ char *lim, *next; struct if_msghdr *ifm, *nextifm; struct sockaddr_dl *sdl; - char s[32]; + char s[IFNAMSIZ]; size_t needed; unsigned long rx_o, tx_o; @@ -149,10 +149,21 @@ /* search for the right network interface */ if (sdl->sdl_family != AF_LINK) continue; - if (strcmp(sdl->sdl_data, data->ifdata.if_name) != 0) + + /* OpenBSD netstat code checks > 0, so do so here */ + if (sdl->sdl_nlen > 0) + { + size_t nlen; + + nlen = MIN(sdl->sdl_nlen, sizeof(s)-1); + strncpy(s, sdl->sdl_data, nlen); + s[nlen] = '\0'; + + if (strcmp(s, data->ifdata.if_name) != 0) + continue; + } + else continue; - strncpy(s, sdl->sdl_data, sdl->sdl_nlen); - s[sdl->sdl_nlen] = '\0'; rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; /* write stats */