diff options
Diffstat (limited to 'src/main/extractor_datasource.c')
-rw-r--r-- | src/main/extractor_datasource.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/extractor_datasource.c b/src/main/extractor_datasource.c index 8b4c611..888e524 100644 --- a/src/main/extractor_datasource.c +++ b/src/main/extractor_datasource.c | |||
@@ -462,6 +462,7 @@ cfs_init_decompressor_zlib (struct CompressedFileSource *cfs, | |||
462 | { | 462 | { |
463 | unsigned int gzip_header_length = 10; | 463 | unsigned int gzip_header_length = 10; |
464 | unsigned char hdata[12]; | 464 | unsigned char hdata[12]; |
465 | ssize_t rsize; | ||
465 | 466 | ||
466 | if (0 != bfds_seek (cfs->bfds, 0, SEEK_SET)) | 467 | if (0 != bfds_seek (cfs->bfds, 0, SEEK_SET)) |
467 | { | 468 | { |
@@ -469,7 +470,9 @@ cfs_init_decompressor_zlib (struct CompressedFileSource *cfs, | |||
469 | return -1; | 470 | return -1; |
470 | } | 471 | } |
471 | /* Process gzip header */ | 472 | /* Process gzip header */ |
472 | if (sizeof (hdata) > bfds_read (cfs->bfds, hdata, sizeof (hdata))) | 473 | rsize = bfds_read (cfs->bfds, hdata, sizeof (hdata)); |
474 | if ( (-1 == rsize) || | ||
475 | (sizeof (hdata) > (size_t) rsize) ) | ||
473 | return -1; | 476 | return -1; |
474 | if (0 != (hdata[3] & 0x4)) /* FEXTRA set */ | 477 | if (0 != (hdata[3] & 0x4)) /* FEXTRA set */ |
475 | gzip_header_length += 2 + (hdata[10] & 0xff) + ((hdata[11] & 0xff) * 256); | 478 | gzip_header_length += 2 + (hdata[10] & 0xff) + ((hdata[11] & 0xff) * 256); |