From a8ff180596b0f16837bc08cf493c0f9224c6233f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Sun, 10 Nov 2002 14:36:54 +0100 Subject: [PATCH] (sexp_vformat): Abort if format string contains unhandled characters. Rev: src/nettle/sexp-format.c:1.3 --- sexp-format.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sexp-format.c b/sexp-format.c index 22b7bc4a..d445f034 100644 --- a/sexp-format.c +++ b/sexp-format.c @@ -1,4 +1,4 @@ -/* sexp-output.c +/* sexp-format.c * * Writing s-expressions. */ @@ -101,6 +101,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) for (;;) switch (*format++) { + default: + abort(); + case '\0': assert(!nesting); @@ -126,6 +129,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) case '%': switch (*format++) { + default: + abort(); + case 'z': { const char *s = va_arg(args, const char *); @@ -242,8 +248,6 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) #endif /* ! HAVE_LIBGMP */ break; } - default: - abort(); } } } -- GitLab