Skip to content
This repository was archived by the owner on Apr 16, 2019. It is now read-only.

Commit cb28360

Browse files
committed
Fix off-by-one
1 parent 724d0a1 commit cb28360

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c/http.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ size_t range_fetch_read_http_headers( void *ptr, size_t size, size_t nmemb, void
410410

411411
/* HTTP 200 + Content-Length -> Entire file */
412412
else if( rf->http_code == 200 && len > strlen("content-length: x") && strncasecmp(buf, "content-length: ", strlen("content-length: ")) == 0) {
413-
off_t to = (off_t)strtoll(buf + strlen("content-length: "), (void*)(buf + len), 10);
413+
off_t to = (off_t)strtoll(buf + strlen("content-length: "), (void*)(buf + len), 10) - 1;
414414

415415
/* Found to, and from = 0 */
416416
if( range_fetch_expect( rf, 0, to ) != 0 ) {

0 commit comments

Comments
 (0)