Commit a8ff1805 authored by Niels Möller's avatar Niels Möller
Browse files

(sexp_vformat): Abort if format string contains

unhandled characters.

Rev: src/nettle/sexp-format.c:1.3
parent 75689999
/* sexp-output.c /* sexp-format.c
* *
* Writing s-expressions. * Writing s-expressions.
*/ */
...@@ -101,6 +101,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) ...@@ -101,6 +101,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
for (;;) for (;;)
switch (*format++) switch (*format++)
{ {
default:
abort();
case '\0': case '\0':
assert(!nesting); assert(!nesting);
...@@ -126,6 +129,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) ...@@ -126,6 +129,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
case '%': case '%':
switch (*format++) switch (*format++)
{ {
default:
abort();
case 'z': case 'z':
{ {
const char *s = va_arg(args, const char *); const char *s = va_arg(args, const char *);
...@@ -242,8 +248,6 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args) ...@@ -242,8 +248,6 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
#endif /* ! HAVE_LIBGMP */ #endif /* ! HAVE_LIBGMP */
break; break;
} }
default:
abort();
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment