mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-24 22:34:29 +02:00
Corrected a bug in exeflat: it was writing 32 bytes too many from possibly
unexisting buffers after compressing exe files. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1480 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
d6b54e78d0
commit
66f65090dd
@ -210,13 +210,14 @@ static int exeflat(const char *srcfile, const char *dstfile,
|
||||
printf("Compressing kernel - %s format\n", (compress_sys_file)?"sys":"exe");
|
||||
}
|
||||
if (UPX && !compress_sys_file) {
|
||||
ULONG realsize;
|
||||
/* write header without relocations to file */
|
||||
exe_header nheader = *header;
|
||||
nheader.exRelocItems = 0;
|
||||
nheader.exHeaderSize = 2;
|
||||
size += 32;
|
||||
nheader.exPages = (UWORD)(size >> 9);
|
||||
nheader.exExtraBytes = (UWORD)size & 511;
|
||||
realsize = size + 32;
|
||||
nheader.exPages = (UWORD)(realsize >> 9);
|
||||
nheader.exExtraBytes = (UWORD)realsize & 511;
|
||||
if (nheader.exExtraBytes)
|
||||
nheader.exPages++;
|
||||
if (fwrite(&nheader, sizeof(nheader), 1, dest) != 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user