input/trace32_ad: fix potential buffer overflow for unexpected input data
Commit 8c4bff1d25
introduced a routine which prints what mostly should
be text, and avoids non-printable characters. This implementation used an
incorrect format string, which could result in data getting written past
the end of a buffer. Fix the format string.
This commit is contained in:
parent
090f1e1e54
commit
67765e465a
|
@ -120,7 +120,7 @@ static char *printable_name(const char *name)
|
||||||
if (g_ascii_isprint(name[i])) {
|
if (g_ascii_isprint(name[i])) {
|
||||||
*p++ = name[i];
|
*p++ = name[i];
|
||||||
} else {
|
} else {
|
||||||
snprintf(p, 5, "\\x%05x", name[i]);
|
snprintf(p, 5, "\\x%02x", name[i]);
|
||||||
p += strlen("\\x00");
|
p += strlen("\\x00");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue