]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Fix memory overrun while parsing a C++ brace format string.
authorBruno Haible <bruno@clisp.org>
Sun, 12 Nov 2023 00:07:41 +0000 (01:07 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 12 Nov 2023 00:07:41 +0000 (01:07 +0100)
Found with CHERI on CheriBSD.

* gettext-tools/src/format-c++-brace.c (format_parse): Compare the first
character after ':' against '\0', not '0'.

gettext-tools/src/format-c++-brace.c

index 05ae444caa3c556e75f5509ec032385fd58f310f..33fa027fef6a47ab013c086dbfe3af2a0f7bfad3 100644 (file)
@@ -326,7 +326,7 @@ format_parse (const char *format, bool translated, char *fdi,
                 /* Parse format-spec.  */
 
                 /* Parse fill-and-align.  */
-                if ((*format != '0' && *format != '{' && *format != '}')
+                if ((*format != '\0' && *format != '{' && *format != '}')
                     && (format[1] == '<' || format[1] == '>'
                         || format[1] == '^'))
                   format += 2;