1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 14:11:15 +02:00

dmi.c: make sure we call isprint() correctly

ISO C and POSIX require to call ctype functions with values representable
by unsigned char. We have used a char as input so far which might be
negative and hence get sign-extended.

Corresponding to flashrom svn r1852.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Stefan Tauner
2014-10-19 07:54:27 +00:00
parent 73f5bda01d
commit ff9e6c32c3

2
dmi.c
View File

@ -142,7 +142,7 @@ static char *dmi_string(const char *buf, uint8_t string_id, const char *limit)
/* fix junk bytes in the string */
for (i = 0; i < len && buf[i] != '\0'; i++) {
if (isprint(buf[i]))
if (isprint((unsigned char)buf[i]))
newbuf[i] = buf[i];
else
newbuf[i] = ' ';