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

Merge pull request #5448 from taosdata/release/s117

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