未验证 提交 7ba908d5 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #5446 from taosdata/fix/TD-3307

[TD-3307]<fix>: fix too long string append with length >= 64
...@@ -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;
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册