aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-15 20:46:58 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-15 20:46:58 +0200
commitd9d073c66b49b91403484e081eda39d4e5c17cc2 (patch)
tree897ab36d6902cc12ccf765997802a6e89cec04bb
parentf792c47a04c55c82f7ed66c727ebe96ccc99a473 (diff)
downloadlibextractor-d9d073c66b49b91403484e081eda39d4e5c17cc2.tar.gz
libextractor-d9d073c66b49b91403484e081eda39d4e5c17cc2.zip
fix signed/unsigned comparison issue
-rw-r--r--src/main/extractor_datasource.c5
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);