=== modified file 'debian/changelog' --- debian/changelog 2007-12-16 19:37:31 +0000 +++ debian/changelog 2009-09-22 22:47:18 +0000 @@ -1,3 +1,9 @@ +zsync (0.5-1ubuntu3.8.10.1) intrepid-proposed; urgency=low + + * http.c: fixup offsets that are larger than signed ints (LP: #420931) + + -- Steve Beattie Sat, 19 Sep 2009 18:30:36 -0700 + zsync (0.5-1ubuntu3) hardy; urgency=low * Modify Maintainer value to match the DebianMaintainerField === modified file 'http.c' --- http.c 2006-12-21 16:12:20 +0000 +++ http.c 2009-09-20 01:29:54 +0000 @@ -695,12 +695,23 @@ if (buf[2+strlen(rf->boundary)] == '-') { free(rf->boundary); rf->boundary = NULL; goto check_boundary; } for(;buf[0] != '\r' && buf[0] != '\n' && buf[0] != '\0';) { - int from, to; - if (!rfgets(buf,sizeof(buf),rf)) return 0; - buflwr(buf); - if (2 == sscanf(buf,"content-range: bytes %d-%d/",&from,&to)) { - rf->offset = from - global_offset; rf->block_left = to - from + 1; gotr = 1; - } + off_t from, to; + + /* Get next header */ + if (!rfgets(buf, sizeof(buf), rf)) + return 0; + buflwr(buf); /* HTTP headers are case insensitive */ + + /* We're looking for the Content-Range: header, to tell us how + * many bytes and what part of the target file they represent. + */ + if (2 == sscanf(buf, + "content-range: bytes " OFF_T_PF "-" OFF_T_PF "/", + &from, &to)) { + rf->offset = from - global_offset; + rf->block_left = to - from + 1; + gotr = 1; + } } if (!gotr) { fprintf(stderr,"got multipart/byteranges but no Content-Range?");