Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
json: fix buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
afg authored and hydai committed Sep 9, 2019
1 parent 119dd7a commit 986aa01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/eni/json/eni_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ std::vector<jsmntok_t> internalParse(const char* data, int start, int end) {
return result;
}
std::string encodeToken(const jsmntok_t& tok) {
char buffer[16];
sprintf(buffer, "%08x%08x",
char buffer[17];
snprintf(buffer, 17, "%08x%08x",
tok.start - (tok.type == JSMN_STRING),
tok.end + (tok.type == JSMN_STRING)
);
Expand Down

0 comments on commit 986aa01

Please sign in to comment.