From: Gerhard Sittig Date: Mon, 21 May 2018 17:55:58 +0000 (+0200) Subject: input/trace32_ad: fix potential buffer overflow for unexpected input data X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=67765e465aaa8cb68de0b975fbd566169e78caf8;p=libsigrok.git input/trace32_ad: fix potential buffer overflow for unexpected input data Commit 8c4bff1d25e1 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. --- diff --git a/src/input/trace32_ad.c b/src/input/trace32_ad.c index f91ed8b1..b1d801e8 100644 --- a/src/input/trace32_ad.c +++ b/src/input/trace32_ad.c @@ -120,7 +120,7 @@ static char *printable_name(const char *name) if (g_ascii_isprint(name[i])) { *p++ = name[i]; } else { - snprintf(p, 5, "\\x%05x", name[i]); + snprintf(p, 5, "\\x%02x", name[i]); p += strlen("\\x00"); } }