fix show trace json exec error

This commit is contained in:
Cai-Yao 2024-11-01 05:14:07 +00:00 committed by ob-robot
parent 95ba872b56
commit ae0a7453a0

View File

@ -261,7 +261,11 @@ int to_string_and_strip(const char* str, const int64_t length, char* buf, const
}
}
}
if (OB_FAIL(ret) || pos + 2 >= buf_len) {
if (OB_FAIL(ret) || pos + 3 >= buf_len) {
// When the length of the tag exceeds buf_len, need ensure that the json format is legal when truncating.
// Pos in buf_len - 2 will fill ']' later.
buf[buf_len - 4] = '\"';
buf[buf_len - 3] = '}';
buf[buf_len - 1] = 0;
} else {
buf[pos++] = '\"';