Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jul 2026 07:30:00 +0000
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c8af571bf1f8 - stable/14 - authpf(8) read_config() should chop off trailing white space
Message-ID:  <6a69abf8.3f243.b1d22cd@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by kp:

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

commit c8af571bf1f88e6445c8e9a449f600c6fef25252
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-07-21 13:10:16 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-07-29 07:29:29 +0000

    authpf(8) read_config() should chop off trailing white space
    
    if administrator mistakenly types into configuration file
    
    anchor=authpf_test
    
    where 'authpf_test' is followed by white space, the authpf(8)
    is going to use anchor 'authpf_test ' instead of the 'authpf_test'
    which is defined in pf.conf(5) as 'anchor authpf_test/*'
    
    issue kindly reported and patch submitted by
    
    Avinash Duduskar <avinash.duduskar (_at_) gmail (_dot_) com>
    
    OK sashan@
    
    PR:             296958
    MFC after:      1 week
    Obtained from:  OpenBSD, sashan <sashan@openbsd.org>, 2d12a8e44d
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 04f25ef716f74d6bb7941750091c6cb4b51d0b4d)
---
 contrib/pf/authpf/authpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/pf/authpf/authpf.c b/contrib/pf/authpf/authpf.c
index 9858c1c50ced..58ee73bb97ca 100644
--- a/contrib/pf/authpf/authpf.c
+++ b/contrib/pf/authpf/authpf.c
@@ -404,8 +404,8 @@ read_config(FILE *f)
 		if (ap != &pair[2])
 			goto parse_error;
 
-		tp = pair[1] + strlen(pair[1]);
-		while ((*tp == ' ' || *tp == '\t') && tp >= pair[1])
+		tp = pair[1] + strlen(pair[1]) - 1;
+		while (tp >= pair[1] && (*tp == ' ' || *tp == '\t'))
 			*tp-- = '\0';
 
 		if (strcasecmp(pair[0], "anchor") == 0) {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a69abf8.3f243.b1d22cd>