From 212aae5316867d25abb3339a481a043174a33266 Mon Sep 17 00:00:00 2001 From: haojun Liao Date: Tue, 31 Dec 2019 12:19:24 +0800 Subject: [PATCH] add the null-terminated char for binary data add the null-terminated char for the binary data, if the space if available. --- src/client/src/tscParseInsert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 23c3b07284..985fa588a4 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -312,6 +312,10 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload, } strncpy(payload, pToken->z, pToken->n); + + if (pToken->n < pSchema->bytes) { + payload[pToken->n] = 0; // add the null-terminated char if the length of the string is shorter than the available space + } } break; -- GitLab