提交 19fa36ff 编写于 作者: M Minglei Jin

[TS-1222]<fix>(taosdump): fix memory invalid write issues

上级 80938574
...@@ -2053,15 +2053,14 @@ static int getTableDes( ...@@ -2053,15 +2053,14 @@ static int getTableDes(
memset(tableDes->cols[i].value, 0, memset(tableDes->cols[i].value, 0,
sizeof(tableDes->cols[i].value)); sizeof(tableDes->cols[i].value));
int len = strlen((char *)row[0]); int len = strlen((char *)row[0]);
// FIXME for long value if (len <= COL_VALUEBUF_LEN / 4 - 1) {
if (len < (COL_VALUEBUF_LEN - 2)) {
converStringToReadable( converStringToReadable(
(char *)row[0], (char *)row[0],
length[0], length[0],
tableDes->cols[i].value, tableDes->cols[i].value,
len); len);
} else { } else {
tableDes->cols[i].var_value = calloc(1, len * 2); tableDes->cols[i].var_value = calloc(1, len * 4 + 1);
if (tableDes->cols[i].var_value == NULL) { if (tableDes->cols[i].var_value == NULL) {
errorPrint("%s() LN%d, memory alalocation failed!\n", errorPrint("%s() LN%d, memory alalocation failed!\n",
__func__, __LINE__); __func__, __LINE__);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册