From f9405b35d3d27ead229a9f433528acd052356997 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 14 Oct 2024 14:21:38 +0800 Subject: [PATCH] fix: add tag length check in stmt --- source/libs/parser/src/parInsertStmt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 500d0e213e..ee61611bf2 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -218,6 +218,10 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } else { memcpy(&val.i64, bind[c].buffer, colLen); } + if (IS_VAR_DATA_TYPE(pTagSchema->type) && val.nData > pTagSchema->bytes) { + code = TSDB_CODE_PAR_VALUE_TOO_LONG; + goto end; + } if (NULL == taosArrayPush(pTagArray, &val)) { code = terrno; goto end; @@ -566,6 +570,10 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c } else { memcpy(&val.i64, bind[c].buffer, colLen); } + if (IS_VAR_DATA_TYPE(pTagSchema->type) && val.nData > pTagSchema->bytes) { + code = TSDB_CODE_PAR_VALUE_TOO_LONG; + goto end; + } if (NULL == taosArrayPush(pTagArray, &val)) { code = terrno; goto end;