From 7dd69a0eddb6078e5d7c974f0e761a93eed5a202 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 7 Jun 2024 15:00:30 -0400 Subject: reenable checking for invalid use of # and 0 flags --- src/stdio/__conv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stdio/__conv.c b/src/stdio/__conv.c index 2b317400..b48c455b 100644 --- a/src/stdio/__conv.c +++ b/src/stdio/__conv.c @@ -161,5 +161,12 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg) UNDEFINED_FMT(conv, "Unknown conversion specifier '%c'", conv->spec); } + if ((conv->flags & F_ALT) && !strchr("xXaAeEfFgG", conv->spec)) { + UNDEFINED_FMT(conv, "Flag '#' is not supported with conversion specifier '%c'", conv->spec); + } + if ((conv->flags & F_ZERO) && !strchr("diouxXaAeEfFgG", conv->spec)) { + UNDEFINED_FMT(conv, "Flag '0' is not supported with conversion specifier '%c'", conv->spec); + } + return ret; } -- cgit v1.2.1