git: 6bbee85e48f6 - main - pfctl: Don't use unsigned for ptrdiff_t
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 07 Jul 2025 15:07:59 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6bbee85e48f6829e23cbb85b3de385244c6f0df0 commit 6bbee85e48f6829e23cbb85b3de385244c6f0df0 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2025-07-02 13:02:33 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-07-07 15:06:50 +0000 pfctl: Don't use unsigned for ptrdiff_t (unsigned) means (unsigned int) which on ptrdiff_t or size_t or other larger types really is a range reduction... Almost any cast to (unsigned) is a bug. ok millert tb benno Obtained from: OpenBSD, deraadt <deraadt@openbsd.org>, 915c3f33d3 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 5c6102db3b55..ca3ca28475d7 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -6929,7 +6929,7 @@ top: if (c == '-' || isdigit(c)) { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); } @@ -6968,7 +6968,7 @@ nodigits: if (isalnum(c) || c == ':' || c == '_') { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); }