Commit ff9e6c32 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

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: default avatarStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: default avatarStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
parent 73f5bda0
...@@ -142,7 +142,7 @@ static char *dmi_string(const char *buf, uint8_t string_id, const char *limit) ...@@ -142,7 +142,7 @@ static char *dmi_string(const char *buf, uint8_t string_id, const char *limit)
/* fix junk bytes in the string */ /* fix junk bytes in the string */
for (i = 0; i < len && buf[i] != '\0'; i++) { for (i = 0; i < len && buf[i] != '\0'; i++) {
if (isprint(buf[i])) if (isprint((unsigned char)buf[i]))
newbuf[i] = buf[i]; newbuf[i] = buf[i];
else else
newbuf[i] = ' '; newbuf[i] = ' ';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment