Переглянути джерело

* check length of optstring before dereferencing (optstring[1]) it. Fixes #40596

marcoonthegit 1 рік тому
батько
коміт
231007ebda
1 змінених файлів з 1 додано та 1 видалено
  1. 1 1
      rtl/inc/getopts.pp

+ 1 - 1
rtl/inc/getopts.pp

@@ -409,7 +409,7 @@ begin
                    if opterr then
                     writeln(argv[0],': option ',pfound^.name,' requires an argument');
                    nextchar:=0;
-                   if optstring[1]=':' then
+                   if (length(optstring)>0) and (optstring[1]=':') then
                     Internal_getopt:=':'
                    else
                     Internal_getopt:='?';