未验证 提交 82eaa2a5 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #7047 from taosdata/fix/tsim-negative-lenght-nchar-binary

tsim/nchar-binary: fix negative length crash
...@@ -808,6 +808,11 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { ...@@ -808,6 +808,11 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
if (length[i] < 0 || length[i] > 1 << 20) {
fprintf(stderr, "Invalid length(%d) of BINARY or NCHAR\n", length[i]);
exit(-1);
}
memset(value, 0, MAX_QUERY_VALUE_LEN); memset(value, 0, MAX_QUERY_VALUE_LEN);
memcpy(value, row[i], length[i]); memcpy(value, row[i], length[i]);
value[length[i]] = 0; value[length[i]] = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册