未验证 提交 2a660b07 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #12824 from ideal/develop

fix: potential overflow of pThread->label
......@@ -175,7 +175,7 @@ typedef struct HttpThread {
EpollFd pollFd;
int32_t numOfContexts;
int32_t threadId;
char label[HTTP_LABEL_SIZE << 1];
char label[HTTP_LABEL_SIZE << 2];
bool (*processData)(HttpContext *pContext);
} HttpThread;
......
......@@ -313,7 +313,7 @@ bool httpInitConnect() {
HttpThread *pThread = pServer->pThreads;
for (int32_t i = 0; i < pServer->numOfThreads; ++i) {
sprintf(pThread->label, "%s%d", pServer->label, i);
snprintf(pThread->label, sizeof(pThread->label), "%s%d", pServer->label, i);
pThread->processData = pServer->processData;
pThread->threadId = i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册