提交 c9df050d 编写于 作者: Y Yitao CHI

[TS-1242]<fix>(taosdump): fix nchar tag crash

上级 bd675737
...@@ -2074,13 +2074,28 @@ static int getTableDes( ...@@ -2074,13 +2074,28 @@ static int getTableDes(
break; break;
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
{ memset(tableDes->cols[i].value, 0,
memset(tableDes->cols[i].value, 0, sizeof(tableDes->cols[i].note)); sizeof(tableDes->cols[i].value));
char tbuf[COL_NOTE_LEN-2]; // need reserve 2 bytes for ' ' len = strlen((char *)row[0]);
convertNCharToReadable((char *)row[TSDB_SHOW_TABLES_NAME_INDEX], length[0], tbuf, COL_NOTE_LEN); if (len <= COL_VALUEBUF_LEN / 4 - 1) {
sprintf(tableDes->cols[i].value, "%s", tbuf); convertNCharToReadable(
break; (char *)row[0],
length[0],
tableDes->cols[i].value,
len);
} else {
tableDes->cols[i].var_value = calloc(1, len * 4 + 1);
if (tableDes->cols[i].var_value == NULL) {
errorPrint("%s() LN%d, memory alalocation failed!\n",
__func__, __LINE__);
taos_free_result(res);
return -1;
}
convertNCharToReadable((char *)row[0],
length[0],
(char *)(tableDes->cols[i].var_value), len);
} }
break;
case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_TIMESTAMP:
sprintf(tableDes->cols[i].value, "%" PRId64 "", *(int64_t *)row[TSDB_SHOW_TABLES_NAME_INDEX]); sprintf(tableDes->cols[i].value, "%" PRId64 "", *(int64_t *)row[TSDB_SHOW_TABLES_NAME_INDEX]);
#if 0 #if 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册