From 4f7e323b29fbc8dfb818c686d9f644660ebe3178 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 21 Apr 2026 14:33:27 +0200 Subject: [PATCH] mprintf: OR the flags As 'flags' may already have been set to something when parse_conversion() is called, make sure to only OR the new flags. Follow-up to 4e0bfd8cf73603697ddad5d25e94 Closes #21398 --- lib/mprintf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mprintf.c b/lib/mprintf.c index 575c8d5c83..6eaea66b70 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -333,7 +333,7 @@ static bool parse_conversion(const char f, unsigned int *flagp, FormatType type; switch(f) { case 'S': - flags = FLAGS_ALT; + flags |= FLAGS_ALT; type = MTYPE_STRING; break; case 's': @@ -361,7 +361,7 @@ static bool parse_conversion(const char f, unsigned int *flagp, type = MTYPE_LONGU; else type = MTYPE_INTU; - flags = FLAGS_UNSIGNED; + flags |= FLAGS_UNSIGNED; break; case 'o': if(flags & FLAGS_LONGLONG) @@ -370,7 +370,7 @@ static bool parse_conversion(const char f, unsigned int *flagp, type = MTYPE_LONGU; else type = MTYPE_INTU; - flags = FLAGS_OCTAL | FLAGS_UNSIGNED; + flags |= FLAGS_OCTAL | FLAGS_UNSIGNED; break; case 'x': if(flags & FLAGS_LONGLONG) @@ -379,7 +379,7 @@ static bool parse_conversion(const char f, unsigned int *flagp, type = MTYPE_LONGU; else type = MTYPE_INTU; - flags = FLAGS_HEX | FLAGS_UNSIGNED; + flags |= FLAGS_HEX | FLAGS_UNSIGNED; break; case 'X': if(flags & FLAGS_LONGLONG)