On 8/30/22 16:57, Simon Josefsson wrote:
Shouldn't it be like this:

+            if (ckd_mul (&plensize, plen, sizeof (CHAR))                      \

Indeed it should. Thanks for reporting that. I installed the attached.

I wonder why no self-check has caught this?

Apparently I tested it only on platforms with working fnmatch, so the bad code was never compiled.
From a5e751e79466703045e7d11d5d3dfc9e1d1fa78b Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 30 Aug 2022 17:37:06 -0500
Subject: [PATCH] fnmatch: fix stdckdint typo

* lib/fnmatch_loop.c (NEW_PATTERN): Fix typo in previous patch.
Problem and fix reported by Simon Josefsson in:
https://lists.gnu.org/r/bug-gnulib/2022-08/msg00104.html
---
 ChangeLog          | 7 +++++++
 lib/fnmatch_loop.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 904980df7d..8c181a2af1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-08-30  Paul Eggert  <egg...@cs.ucla.edu>
+
+	fnmatch: fix stdckdint typo
+	* lib/fnmatch_loop.c (NEW_PATTERN): Fix typo in previous patch.
+	Problem and fix reported by Simon Josefsson in:
+	https://lists.gnu.org/r/bug-gnulib/2022-08/msg00104.html
+
 2022-08-25  Paul Eggert  <egg...@cs.ucla.edu>
 
 	tempname: simplify by omitting _LIBC code
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c
index 1b16de99b6..3050f0cdcc 100644
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -1039,7 +1039,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
             idx_t slen = FLEXSIZEOF (struct patternlist, str, 0);             \
             idx_t new_used = alloca_used + slen;                              \
             idx_t plensize;                                                   \
-            if (ckd_mul (&plensize, plen, sizeof (CHAR), &plensize)           \
+            if (ckd_mul (&plensize, plen, sizeof (CHAR))                      \
                 || ckd_add (&new_used, new_used, plensize))                   \
               {                                                               \
                 retval = -2;                                                  \
-- 
2.37.2

Reply via email to