提交 a7c04329 编写于 作者: X xicai.cxc 提交者: jun-ping

BugID:23661689:[http] fix long http header memory overflow issue

Change-Id: I416def4177884e50c38fb76af2cd2c73b4eff456
上级 62d494e1
......@@ -652,7 +652,13 @@ int httpclient_response_parse(httpclient_t *client, char *data, int len, uint32_
/* try to read more header again until find response head ending "\r\n\r\n" */
while (NULL == (ptr_body_end = strstr(data, "\r\n\r\n"))) {
/* try to read more header */
ret = httpclient_recv(client, data + len, 1, HTTPCLIENT_RAED_HEAD_SIZE, &new_trf_len, iotx_time_left(&timer));
int max_remain_len = HTTPCLIENT_CHUNK_SIZE - len - 1;
if (max_remain_len <= 0) {
utils_err("buffer exceeded max\n");
return ERROR_HTTP_PARSE;
}
max_remain_len = max_remain_len > HTTPCLIENT_RAED_HEAD_SIZE ? HTTPCLIENT_RAED_HEAD_SIZE : max_remain_len;
ret = httpclient_recv(client, data + len, 1, max_remain_len, &new_trf_len, iotx_time_left(&timer));
if (ret == ERROR_HTTP_CONN) {
return ret;
}
......
......@@ -531,6 +531,11 @@ int IOT_HTTP_DeviceNameAuth(void *handle)
goto do_exit;
}
if(strlen(pvalue) > IOTX_HTTP_AUTH_TOKEN_LEN - 1) {
http_err("token is out of size");
goto do_exit;
}
strcpy(iotx_http_context->p_auth_token, pvalue);
iotx_http_context->is_authed = 1;
LITE_free(pvalue);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册