未验证 提交 fcae1ef2 编写于 作者: H haojun Liao 提交者: GitHub

Merge pull request #5448 from taosdata/release/s117

Release/s117
......@@ -110,7 +110,7 @@ static void httpCleanupString(HttpString *str) {
static int32_t httpAppendString(HttpString *str, const char *s, int32_t len) {
if (str->size == 0) {
str->pos = 0;
str->size = 64;
str->size = len + 1;
str->str = malloc(str->size);
} else if (str->pos + len + 1 >= str->size) {
str->size += len;
......@@ -715,10 +715,12 @@ static int32_t httpParserOnVersion(HttpParser *parser, HTTP_PARSER_STATE state,
if (parser->method) {
ok = httpOnRequestLine(parser, parser->method, parser->target, parser->version);
/*
if (parser->target) {
free(parser->target);
parser->target = NULL;
}
*/
}
httpClearString(&parser->str);
......
......@@ -2747,7 +2747,10 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag,
}
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
tVariantCreateFromBinary(tag, varDataVal(val), varDataLen(val), type);
int32_t maxLen = bytes - VARSTR_HEADER_SIZE;
int32_t len = (varDataLen(val) > maxLen)? maxLen:varDataLen(val);
tVariantCreateFromBinary(tag, varDataVal(val), len, type);
//tVariantCreateFromBinary(tag, varDataVal(val), varDataLen(val), type);
} else {
tVariantCreateFromBinary(tag, val, bytes, type);
}
......@@ -6539,8 +6542,15 @@ static void doSetTagValueToResultBuf(char* output, const char* val, int16_t type
return;
}
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) {
memcpy(output, val, varDataTLen(val));
if (IS_VAR_DATA_TYPE(type)) {
// Binary data overflows for sort of unknown reasons. Let trim the overflow data
if (varDataTLen(val) > bytes) {
int32_t len = bytes - VARSTR_HEADER_SIZE; // remain available space
memcpy(varDataVal(output), varDataVal(val), len);
varDataSetLen(output, len);
} else {
varDataCopy(output, val);
}
} else {
memcpy(output, val, bytes);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册