mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-02 19:29:21 +00:00
Give an error if file names or command-line parameters are too long.
The source file name, keep name, NAMES= string, and cc= string are all restricted to 255 characters, but these limits were not previously enforced, and exceeding them could lead to strange behavior.
This commit is contained in:
parent
bd811559d6
commit
06e17cd8f5
24
CC.pas
24
CC.pas
@ -36,7 +36,7 @@ begin {cc}
|
|||||||
{make sure we quit with restart set}
|
{make sure we quit with restart set}
|
||||||
SystemQuitFlags($4000);
|
SystemQuitFlags($4000);
|
||||||
|
|
||||||
{get the command line info}
|
{initialize file names and parameter strings}
|
||||||
includeFileGS.maxSize := maxPath+4;
|
includeFileGS.maxSize := maxPath+4;
|
||||||
includeFileGS.theString.size := 0;
|
includeFileGS.theString.size := 0;
|
||||||
for i := 1 to maxPath do
|
for i := 1 to maxPath do
|
||||||
@ -44,6 +44,14 @@ for i := 1 to maxPath do
|
|||||||
outFileGS := includeFileGS;
|
outFileGS := includeFileGS;
|
||||||
partialFileGS := includeFileGS;
|
partialFileGS := includeFileGS;
|
||||||
infoStringGS := includeFileGS;
|
infoStringGS := includeFileGS;
|
||||||
|
|
||||||
|
{check the version number}
|
||||||
|
vDCBGS.pCount := 1;
|
||||||
|
VersionGS(vDCBGS);
|
||||||
|
if (ToolError <> 0) or (vDCBGS.version[1] < '2') then
|
||||||
|
TermError(10);
|
||||||
|
|
||||||
|
{get the command line info}
|
||||||
with liDCBGS do begin
|
with liDCBGS do begin
|
||||||
pCount := 11;
|
pCount := 11;
|
||||||
sFile := @includeFileGS;
|
sFile := @includeFileGS;
|
||||||
@ -52,6 +60,14 @@ with liDCBGS do begin
|
|||||||
iString := @infoStringGS;
|
iString := @infoStringGS;
|
||||||
end; {with}
|
end; {with}
|
||||||
GetLInfoGS(liDCBGS);
|
GetLInfoGS(liDCBGS);
|
||||||
|
if ToolError <> 0 then begin {check for buffTooSmall errors}
|
||||||
|
includeFileGS.theString.size := 0;
|
||||||
|
outFileGS.theString.size := 0;
|
||||||
|
partialFileGS.theString.size := 0;
|
||||||
|
infoStringGS.theString.size := 0;
|
||||||
|
enterEditor := false;
|
||||||
|
TermError(13);
|
||||||
|
end; {if}
|
||||||
sourceFileGS := includeFileGS;
|
sourceFileGS := includeFileGS;
|
||||||
doingPartial := partialFileGS.theString.size <> 0;
|
doingPartial := partialFileGS.theString.size <> 0;
|
||||||
with liDCBGS do begin
|
with liDCBGS do begin
|
||||||
@ -70,12 +86,6 @@ with liDCBGS do begin
|
|||||||
if list then {we don't need both...}
|
if list then {we don't need both...}
|
||||||
progress := false;
|
progress := false;
|
||||||
|
|
||||||
{check the version number}
|
|
||||||
vDCBGS.pCount := 1;
|
|
||||||
VersionGS(vDCBGS);
|
|
||||||
if vDCBGS.version[1] < '2' then
|
|
||||||
TermError(10);
|
|
||||||
|
|
||||||
{write the header}
|
{write the header}
|
||||||
if list or progress then begin
|
if list or progress then begin
|
||||||
writeln('ORCA/C ', versionStr);
|
writeln('ORCA/C ', versionStr);
|
||||||
|
@ -999,6 +999,7 @@ case errnum of {print the error}
|
|||||||
10: msg := 'ORCA/C requires version 2.0 or later of the shell';
|
10: msg := 'ORCA/C requires version 2.0 or later of the shell';
|
||||||
11: msg := 'The program is too large to compile to memory -- use Compile to Disk';
|
11: msg := 'The program is too large to compile to memory -- use Compile to Disk';
|
||||||
12: msg := 'Invalid sym file detected. Re-run ORCA/C to proceed.';
|
12: msg := 'Invalid sym file detected. Re-run ORCA/C to proceed.';
|
||||||
|
13: msg := 'file name or command-line parameter is too long';
|
||||||
otherwise: begin
|
otherwise: begin
|
||||||
msg := '';
|
msg := '';
|
||||||
Error(57);
|
Error(57);
|
||||||
|
Loading…
Reference in New Issue
Block a user