[PATCH 2/3] Do not call fputc from _bfd_doprnt
Tom Tromey
tom@tromey.com
Tue Jan 30 01:03:32 GMT 2024
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/ChangeLog
2024-01-29 Tom Tromey <tom@tromey.com>
* bfd.c (_bfd_doprnt): Do not call fputc.
---
bfd/ChangeLog | 4 ++++
bfd/bfd.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 5619799e403..0f1eaa1629f 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;
}
--
2.43.0
More information about the Binutils
mailing list