1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Fix the snprintf size issue.

This commit is contained in:
winlin 2022-08-10 08:32:02 +08:00
parent 1ab584b2ae
commit a71eddd56a
10 changed files with 46 additions and 17 deletions

View file

@ -1582,8 +1582,8 @@ string SrsJsonAny::dumps()
}
case SRS_JSON_Number: {
// len(max int64_t) is 20, plus one "+-."
char tmp[22];
snprintf(tmp, 22, "%.2f", to_number());
char tmp[21 + 1];
snprintf(tmp, sizeof(tmp), "%.2f", to_number());
return tmp;
}
case SRS_JSON_Null: {