git: 84ff9e9122ac - main - pf: fix overly large memcpy()

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 04 Jun 2024 17:44:55 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=84ff9e9122acf23252680784724d6d565e734d31

commit 84ff9e9122acf23252680784724d6d565e734d31
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-04 15:29:13 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 17:44:20 +0000

    pf: fix overly large memcpy()
    
    We only want to copy the labels array, we don't want to copy the counter as well.
    
    Reported by:    CheriBSD
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/netpfil/pf/pf_nl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index 1074c561cd15..cf5146c716c6 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -532,7 +532,7 @@ nlattr_get_nested_pf_rule_labels(struct nlattr *nla, struct nl_pstate *npt, cons
 	if (error != 0)
 		return (error);
 
-	memcpy(target, parsed_labels.labels, sizeof(parsed_labels));
+	memcpy(target, parsed_labels.labels, sizeof(parsed_labels.labels));
 
 	return (0);
 }