diff --git a/sys/net/wg/if_wg.c b/sys/net/wg/if_wg.c --- a/sys/net/wg/if_wg.c +++ b/sys/net/wg/if_wg.c @@ -2286,6 +2286,10 @@ * The packets have the same DLT_NULL link-layer type * (i.e., 4-byte link-layer header in host byte order). */ + if (m->m_pkthdr.len < sizeof(uint32_t)) { + ret = EINVAL; + goto error; + } dst->sa_family = *(mtod(m, uint32_t *)); m_adj(m, sizeof(uint32_t)); }