Merge pull request #4946 from taosdata/fix/TD-2697
[TD-2697]<fix>: fix buffer overflow
This commit is contained in:
commit
dc11780c24
|
@ -385,12 +385,22 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
SConnObj *pConnObj = NULL;
|
SConnObj *pConnObj = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
char * pWrite;
|
char * pWrite;
|
||||||
|
void * pIter;
|
||||||
char str[TSDB_IPv4ADDR_LEN + 6] = {0};
|
char str[TSDB_IPv4ADDR_LEN + 6] = {0};
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
|
pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
|
||||||
if (pConnObj == NULL) break;
|
if (pConnObj == NULL) {
|
||||||
|
pShow->pIter = pIter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numOfRows + pConnObj->numOfQueries >= rows) {
|
||||||
|
mnodeCancelGetNextConn(pIter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pShow->pIter = pIter;
|
||||||
for (int32_t i = 0; i < pConnObj->numOfQueries; ++i) {
|
for (int32_t i = 0; i < pConnObj->numOfQueries; ++i) {
|
||||||
SQueryDesc *pDesc = pConnObj->pQueries + i;
|
SQueryDesc *pDesc = pConnObj->pQueries + i;
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
@ -518,12 +528,22 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
SConnObj *pConnObj = NULL;
|
SConnObj *pConnObj = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
char * pWrite;
|
char * pWrite;
|
||||||
|
void * pIter;
|
||||||
char ipStr[TSDB_IPv4ADDR_LEN + 6];
|
char ipStr[TSDB_IPv4ADDR_LEN + 6];
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
|
pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
|
||||||
if (pConnObj == NULL) break;
|
if (pConnObj == NULL) {
|
||||||
|
pShow->pIter = pIter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numOfRows + pConnObj->numOfStreams >= rows) {
|
||||||
|
mnodeCancelGetNextConn(pIter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pShow->pIter = pIter;
|
||||||
for (int32_t i = 0; i < pConnObj->numOfStreams; ++i) {
|
for (int32_t i = 0; i < pConnObj->numOfStreams; ++i) {
|
||||||
SStreamDesc *pDesc = pConnObj->pStreams + i;
|
SStreamDesc *pDesc = pConnObj->pStreams + i;
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
Loading…
Reference in New Issue