From cedf009d3c798f6d06ca8c32ef4ef859f1ea244c Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Sun, 18 May 2014 20:37:40 +0000 Subject: [PATCH] * fix for SIGSEGV in Exec without command line parameters revealed in discussion for #26160 git-svn-id: trunk@27804 - --- rtl/go32v2/dos.pp | 3 +-- rtl/msdos/dos.pp | 3 +-- rtl/watcom/dos.pp | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/rtl/go32v2/dos.pp b/rtl/go32v2/dos.pp index dbe31e29ad..bcc80344cf 100644 --- a/rtl/go32v2/dos.pp +++ b/rtl/go32v2/dos.pp @@ -436,8 +436,7 @@ begin seg_move (get_ds, PtrInt (ExecBufPtr), DosMemSelector, TB, Pred (Current_Dos_Buffer_Pos)); { allocate FCB see dosexec code } arg_ofs:=1; - while (c[arg_ofs] in [' ',#9]) and - (arg_ofs#13 then + until (Arg_Ofs >= Length (C)) or (c[arg_ofs] in [' ',#9,#13]); + if (c[arg_ofs]<>#13) and (Arg_Ofs < Length (C)) then begin repeat inc(arg_ofs); - until not (c[arg_ofs] in [' ',#9]); + until (Arg_Ofs > Length (C)) or not (c[arg_ofs] in [' ',#9]); end; dosregs.ax:=$2901; dosregs.ds:=(la_c+arg_ofs) shr 4;