From 91095bcf2820f3d77ea1e16a338e686ba6a70e9f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 12 Feb 2024 14:25:03 -0700 Subject: [PATCH] Do not call fputc from _bfd_doprnt I noticed that _bfd_doprnt can unconditionally call fputc. However, when called from error_handler_sprintf, this will likely result in a crash, as the stream argument does not actually point to a FILE. * bfd.c (_bfd_doprnt): Do not call fputc. --- bfd/bfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/bfd.c b/bfd/bfd.c index 0776145af52..6c60227f1dc 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1027,7 +1027,7 @@ _bfd_doprnt (print_func print, void *stream, const char *format, } else if (ptr[1] == '%') { - fputc ('%', stream); + print (stream, "%%"); result = 1; ptr += 2; }