Small cleanups.
committer: mfx <mfx> 978539758 +0000
This commit is contained in:
+4
-3
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user