Small cleanups.

committer: mfx <mfx> 978539758 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2001-01-03 16:35:58 +00:00
parent df4726eb95
commit c5e61413a4
+4 -3
View File
@@ -147,7 +147,8 @@ int PackVmlinuzI386::decompressKernel()
if (off < 0) if (off < 0)
break; break;
gzoff += off; gzoff += off;
if (gzoff + 256 >= file_size) const int gzlen = file_size - gzoff;
if (gzlen < 256)
break; break;
// check gzip flag byte // check gzip flag byte
unsigned char flags = obuf[gzoff + 3]; unsigned char flags = obuf[gzoff + 3];
@@ -174,7 +175,7 @@ int PackVmlinuzI386::decompressKernel()
break; break;
// estimate gzip-decompressed kernel size & alloc buffer // estimate gzip-decompressed kernel size & alloc buffer
if (ibuf.getSize() == 0) if (ibuf.getSize() == 0)
ibuf.alloc((file_size - gzoff) * 3); ibuf.alloc(gzlen * 3);
// decompress // decompress
klen = gzread(zf, ibuf, ibuf.getSize()); klen = gzread(zf, ibuf, ibuf.getSize());
fd_pos = lseek(fd, 0, SEEK_CUR); fd_pos = lseek(fd, 0, SEEK_CUR);
@@ -192,7 +193,7 @@ int PackVmlinuzI386::decompressKernel()
if (klen <= 0) if (klen <= 0)
continue; continue;
if (klen <= file_size - gzoff) if (klen <= gzlen)
continue; continue;
if (opt->force > 0) if (opt->force > 0)