提交 074303fb 编写于 作者: S shenglian zhou

<fix>:change parser so that keep parameter can not be greater than TSDB_MAX_KEEP

上级 c879506a
......@@ -6741,16 +6741,21 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p
tVariantListItem* p1 = (s > 1) ? taosArrayGet(pKeep, 1) : p0;
tVariantListItem* p2 = (s > 2) ? taosArrayGet(pKeep, 2) : p1;
if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) {
int32_t daysToKeep0 = (int32_t)p0->pVar.i64;
int32_t daysToKeep1 = (int32_t)(int32_t)p1->pVar.i64;
int32_t daysToKeep2 = (int32_t)p2->pVar.i64;
if (daysToKeep0 <= 0 || daysToKeep1 <= 0 || daysToKeep2 <= 0 ||
daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
if (!(((int32_t)p0->pVar.i64 <= (int32_t)p1->pVar.i64) && ((int32_t)p1->pVar.i64 <= (int32_t)p2->pVar.i64))) {
if (!((daysToKeep0 <= daysToKeep1) && (daysToKeep1 <= daysToKeep2))) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
pMsg->daysToKeep0 = htonl((int32_t)p0->pVar.i64);
pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64);
pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64);
pMsg->daysToKeep0 = htonl(daysToKeep0);
pMsg->daysToKeep1 = htonl(daysToKeep1);
pMsg->daysToKeep2 = htonl(daysToKeep2);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册