git: 1d16286078d3 - main - libc/fnmatch/rangematch: fix incorrect arguments to memset
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 22 Nov 2026 16:16:40 UTC
The branch main has been updated by avg:
URL: https://cgit.FreeBSD.org/src/commit/?id=1d16286078d351fa603398588e1455581af52d05
commit 1d16286078d351fa603398588e1455581af52d05
Author: Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2026-11-22 15:16:22 +0000
Commit: Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2026-11-22 16:16:31 +0000
libc/fnmatch/rangematch: fix incorrect arguments to memset
strmbs variable is already a pointer, so calling memset on its address
was equivalent to setting the pointer, but the intent was to set the
pointed object.
This was found while debugging an unrelated issue in the same function.
Fixes: af79566b9315
MFC after: 1 week
---
lib/libc/gen/fnmatch.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c
index 1c583a9d23e2..1bb020da229b 100644
--- a/lib/libc/gen/fnmatch.c
+++ b/lib/libc/gen/fnmatch.c
@@ -324,8 +324,8 @@ treat_like_collating_symbol:
sclen == (size_t)-2) {
sc = (unsigned char)*string;
sclen = 1;
- memset(&strmbs, 0,
- sizeof(strmbs));
+ memset(strmbs, 0,
+ sizeof(*strmbs));
}
if (sc != *wp++) {
memcpy(strmbs, &save,