From: Bruno Haible Date: Sun, 12 Nov 2023 00:07:41 +0000 (+0100) Subject: xgettext: Fix memory overrun while parsing a C++ brace format string. X-Git-Tag: v0.23~305 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c567dde0c0af8bb95b122cd989077b00e23f57e1;p=thirdparty%2Fgettext.git xgettext: Fix memory overrun while parsing a C++ brace format string. Found with CHERI on CheriBSD. * gettext-tools/src/format-c++-brace.c (format_parse): Compare the first character after ':' against '\0', not '0'. --- diff --git a/gettext-tools/src/format-c++-brace.c b/gettext-tools/src/format-c++-brace.c index 05ae444ca..33fa027fe 100644 --- a/gettext-tools/src/format-c++-brace.c +++ b/gettext-tools/src/format-c++-brace.c @@ -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;