Module Name: src
Committed By: joe
Date: Sun Feb 16 15:56:06 UTC 2025
Modified Files:
src/sys/dev/hyperv: if_hvn.c
Log Message:
avoid buffer overflow when copying the ether header host into the ether vland
header host
on hyper-v
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/hyperv/if_hvn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.28 src/sys/dev/hyperv/if_hvn.c:1.29
--- src/sys/dev/hyperv/if_hvn.c:1.28 Fri Jul 5 04:31:50 2024
+++ src/sys/dev/hyperv/if_hvn.c Sun Feb 16 15:56:06 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: if_hvn.c,v 1.28 2024/07/05 04:31:50 rin Exp $ */
+/* $NetBSD: if_hvn.c,v 1.29 2025/02/16 15:56:06 joe Exp $ */
/* $OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $ */
/*-
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.28 2024/07/05 04:31:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.29 2025/02/16 15:56:06 joe Exp $");
#ifdef _KERNEL_OPT
#include "opt_if_hvn.h"
@@ -1697,7 +1697,7 @@ hvn_bpf_mtap(struct hvn_tx_ring *txr, st
*/
eh = mtod(m, struct ether_header *);
- memcpy(evl.evl_dhost, eh->ether_dhost, ETHER_ADDR_LEN * 2);
+ memcpy(evl.evl_dhost, eh->ether_dhost, ETHER_ADDR_LEN);
evl.evl_encap_proto = htons(ETHERTYPE_VLAN);
evl.evl_tag = htons(vlan_get_tag(m));
evl.evl_proto = eh->ether_type;
@@ -4836,7 +4836,7 @@ hvn_rxeof(struct hvn_rx_ring *rxr, uint8
evl = mtod(m, struct ether_vlan_header *);
memcpy(evl->evl_dhost, eh.ether_dhost,
- ETHER_ADDR_LEN * 2);
+ ETHER_ADDR_LEN);
evl->evl_encap_proto = htons(ETHERTYPE_VLAN);
evl->evl_tag = htons(t);
evl->evl_proto = eh.ether_type;