]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Modula-2 support: Fix possible crash during format string checking.
authorBruno Haible <bruno@clisp.org>
Thu, 3 Jul 2025 13:47:02 +0000 (15:47 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 3 Jul 2025 15:40:37 +0000 (17:40 +0200)
* gettext-tools/src/format-modula2.c (format_check): Fix error message. Fix loop
bound.

gettext-tools/src/format-modula2.c

index eb741887345bb3c1e67b43fbe69b679fb9d4cfb0..3f3ea4052039108c2bea25ebeec421c02b2625b7 100644 (file)
@@ -207,7 +207,7 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality,
           if (error_logger)
             error_logger (error_logger_data,
                           _("a format specification for argument %zu doesn't exist in '%s'"),
-                          n1 + 1, pretty_msgstr);
+                          n2 + 1, pretty_msgstr);
           err = true;
         }
       else
@@ -216,7 +216,7 @@ format_check (void *msgid_descr, void *msgstr_descr, bool equality,
 
           /* Check that the argument types are the same.  */
           if (!err)
-            for (i = 0; i < n1; i++)
+            for (i = 0; i < n2; i++)
               {
                 if (spec1->args[i] != spec2->args[i])
                   {