From bfb591c65f576f96ea582f36724f66bd5fa3c965 Mon Sep 17 00:00:00 2001 From: liu0x54 Date: Thu, 26 Mar 2020 15:37:16 +0800 Subject: [PATCH] [TD-53] fix bug: when the result set tag's value is null, TDengine crashed --- src/modules/http/src/gcJson.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/http/src/gcJson.c b/src/modules/http/src/gcJson.c index 51f7f18345..66b4e3dfe0 100644 --- a/src/modules/http/src/gcJson.c +++ b/src/modules/http/src/gcJson.c @@ -152,9 +152,11 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:", fields[i].name); - memcpy(target + len, (char *) row[i], fields[i].bytes); - len = strlen(target); + if (row[i]!= NULL){ + len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:", fields[i].name); + memcpy(target + len, (char *) row[i], fields[i].bytes); + len = strlen(target); + } break; default: len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%s", fields[i].name, "-"); -- GitLab