From 3cff24c4a70f69e6418505be058001b74b82dad8 Mon Sep 17 00:00:00 2001 From: Ulf Wohlers Date: Fri, 7 Mar 2003 11:31:13 +0000 Subject: [PATCH] fixed buf if extrabytes are zero. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@726 --- src/dos/dos_execute.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dos/dos_execute.cpp b/src/dos/dos_execute.cpp index 56d8ca38..789ce2e7 100644 --- a/src/dos/dos_execute.cpp +++ b/src/dos/dos_execute.cpp @@ -240,8 +240,12 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) { if ((head.signature!=MAGIC1) && (head.signature!=MAGIC2)) iscom=true; else { headersize=head.headersize*16; - imagesize=(head.pages-1)*512-headersize; - if (head.extrabytes) imagesize += head.extrabytes % 512; + if (head.extrabytes) { + imagesize = (head.pages-1)*512-headersize; + imagesize += head.extrabytes % 512; + } else + imagesize = head.pages*512-headersize; + // always load st least 512 Bytes (dos cache/dos bug?) if (imagesize+headersize<512) imagesize = 512-headersize; }