Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http client: fix the I/O limit check
  • Loading branch information
perexg committed Nov 18, 2015
1 parent e7d588d commit ae441a3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/httpc.c
Expand Up @@ -889,7 +889,7 @@ http_client_run( http_client_t *hc )
char *buf, *saveptr, *argv[3], *d, *p;
int ver, res, delimsize = 4;
ssize_t r;
size_t len, limit;
size_t len;

if (hc == NULL)
return 0;
Expand Down Expand Up @@ -954,7 +954,6 @@ http_client_run( http_client_t *hc )
tvhlog_hexdump("httpc", buf, MIN(64, r));
}

limit = hc->hc_version == RTSP_VERSION_1_0 ? hc->hc_io_size * 2 : 16*1024;
if (hc->hc_in_data && !hc->hc_in_rtp_data) {
res = http_client_data_received(hc, buf, r, 0);
if (res < 0)
Expand All @@ -967,7 +966,7 @@ http_client_run( http_client_t *hc )
}

if (hc->hc_rsize < r + hc->hc_rpos) {
if (hc->hc_rsize + r > limit)
if (hc->hc_rsize + r > hc->hc_io_size + 16*1024)
return http_client_flush(hc, -EMSGSIZE);
hc->hc_rsize += r;
hc->hc_rbuf = realloc(hc->hc_rbuf, hc->hc_rsize + 1);
Expand Down

0 comments on commit ae441a3

Please sign in to comment.