From 2084b677b129fa0809f66d01be9f1d113bad5d71 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 29 Aug 2024 17:24:34 +0800 Subject: [PATCH] fix:[TD-31242] add parameters check --- source/client/src/clientMain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 9b336d27f2..57faa4b739 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -860,12 +860,13 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) { } int taos_is_null_by_column(TAOS_RES *res, int columnIndex, bool result[], int *rows){ - if (res == NULL || result == NULL || *rows <= 0 || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { + if (res == NULL || result == NULL || rows == NULL || *rows <= 0 || + columnIndex < 0 || TD_RES_TMQ_META(res) || TD_RES_TMQ_BATCH_META(res)) { return TSDB_CODE_INVALID_PARA; } int32_t numOfFields = taos_num_fields(res); - if (columnIndex < 0 || columnIndex >= numOfFields || numOfFields == 0) { + if (columnIndex >= numOfFields || numOfFields == 0) { return TSDB_CODE_INVALID_PARA; }