From: Tom Tromey Date: Mon, 12 Feb 2024 21:25:03 +0000 (-0700) Subject: Do not call fputc from _bfd_doprnt X-Git-Tag: gdb-15-branchpoint~987 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91095bcf2820f3d77ea1e16a338e686ba6a70e9f;p=thirdparty%2Fbinutils-gdb.git 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. --- 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; }