@@ -, +, @@ PR binutils/18750 * ihex.c (ihex_bad_byte): Fix incorrect escape sequence (and stack overflow) on platforms with signed char. * srec.c (srec_bad_byte): Ditto (but impossible to trigger). * readelf.c (process_mips_specific): Ditto (but no stack overflow). --- bfd/ihex.c | 2 +- bfd/srec.c | 2 +- binutils/readelf.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) --- a/bfd/ihex.c +++ a/bfd/ihex.c @@ -219,7 +219,7 @@ ihex_bad_byte (bfd *abfd, unsigned int lineno, int c, bfd_boolean error) char buf[10]; if (! ISPRINT (c)) - sprintf (buf, "\\%03o", (unsigned int) c); + sprintf (buf, "\\%03o", (unsigned int) c & 0xff); else { buf[0] = c; --- a/bfd/srec.c +++ a/bfd/srec.c @@ -249,7 +249,7 @@ srec_bad_byte (bfd *abfd, char buf[40]; if (! ISPRINT (c)) - sprintf (buf, "\\%03o", (unsigned int) c); + sprintf (buf, "\\%03o", (unsigned int) c & 0xff); else { buf[0] = c; --- a/binutils/readelf.c +++ a/binutils/readelf.c @@ -14467,7 +14467,7 @@ process_mips_specific (FILE * file) len = sizeof (* eopt); while (len < option->size) { - char datum = * ((char *) eopt + offset + len); + unsigned char datum = * ((unsigned char *) eopt + offset + len); if (ISPRINT (datum)) printf ("%c", datum); --