git: a8136ab47c97 - main - pfctl: convert an snprintf to strlcpy
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 14 Jan 2025 10:37:56 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=a8136ab47c97d470b39246b53a64ebbe76f5413f
commit a8136ab47c97d470b39246b53a64ebbe76f5413f
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-01-09 09:23:23 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-01-14 08:54:19 +0000
pfctl: convert an snprintf to strlcpy
ok mikeb henning
Obtained from: OpenBSD, dhill <dhill@openbsd.org>, a592d7cf61
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sbin/pfctl/pfctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 4b2a69f456a2..ca374ca3295d 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1234,7 +1234,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
if (anchorname[0] == '/') {
if ((npath = calloc(1, MAXPATHLEN)) == NULL)
errx(1, "pfctl_rules: calloc");
- snprintf(npath, MAXPATHLEN, "%s", anchorname);
+ strlcpy(npath, anchorname, MAXPATHLEN);
} else {
if (path[0])
snprintf(&path[len], MAXPATHLEN - len, "/%s", anchorname);