diff --git a/lib/token.cpp b/lib/token.cpp index 98f79b4bb1d..44e62e21507 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -1607,8 +1607,8 @@ static std::string stringFromTokenRange(const Token* start, const Token* end) else if (c >= ' ' && c <= 126) ret += c; else { - char str[10]; - sprintf(str, "\\x%02x", c); + char str[5]; + snprintf(str, sizeof(str), "\\x%02x", c); ret += str; } }