diff options
author | pierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-07-06 20:56:14 +0000 |
---|---|---|
committer | pierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-07-06 20:56:14 +0000 |
commit | 3c7ccd8ce607bb709859e0bca3b5654939a7cad4 (patch) | |
tree | 807c924e304247c857dfbe0ea6a90244456035aa | |
parent | 3818fa7db61ef95227e32a240ae4ab2aebe9f0de (diff) | |
download | fpc-3c7ccd8ce607bb709859e0bca3b5654939a7cad4.tar.gz |
Make sure that we do not read passed the end of OPTSTRING variable
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@45736 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | rtl/inc/getopts.pp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rtl/inc/getopts.pp b/rtl/inc/getopts.pp index ecf3e43288..a466b32f43 100644 --- a/rtl/inc/getopts.pp +++ b/rtl/inc/getopts.pp @@ -460,8 +460,8 @@ begin exit; end; Internal_getopt:=optstring[temp]; - if optstring[temp+1]=':' then - if optstring[temp+2]=':' then + if (length(optstring)>temp) and (optstring[temp+1]=':') then + if (length(optstring)>temp+1) and (optstring[temp+2]=':') then begin { optional argument } if nextchar>0 then begin |