Skip to content

Commit e3e9e09

Browse files
authored
Changed sprintf to snprintf (#180)
1 parent 78ffe17 commit e3e9e09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ static std::string json_escape(std::string const& in)
496496
// escape and print as unicode codepoint
497497
constexpr int printed_unicode_length = 6; // 4 hex + letter 'u' + \0
498498
std::array<char, printed_unicode_length> buf;
499-
sprintf(buf.data(), "u%04x", ch);
499+
snprintf(buf.data(), buf.size(), "u%04x", ch);
500500
out.append(buf.data(), buf.size() - 1); // add only five, discarding the null terminator.
501501
break;
502502
}

0 commit comments

Comments
 (0)