LazUtils: Masks: disallow #0 in the user supplied mask for TWindowsMask.

Note: code contains writeln's, so it will crash if no console is available.
This commit is contained in:
Bart 2021-11-09 18:55:15 +01:00
parent cd4ce74027
commit aae437d605

View File

@ -1408,10 +1408,16 @@ var
lFileNameMask: String;
lExtensionMask: String;
lModifiedMask: String;
ZeroPos: SizeInt;
begin
lModifiedMask:=fWindowsMask;
//We cannot have #0 in the mask,since we use it internally
ZeroPos:=Pos(#0, fWindowsMask);
if ZeroPos>0 then
Exception_InvalidCharMask('NullCharacter', ZeroPos);
// Quirk "blah.*" = "blah*"
if wqAnyExtension in fWindowsQuirkAllowed then begin
if RightStr(lModifiedMask,3)='*.*' then begin
@ -1448,7 +1454,7 @@ begin
end;
end;
}
// Quirk "file???.ab?" matches "file1.ab1" and "file123.ab"
if wqFilenameEnd in fWindowsQuirkAllowed then begin
lFileNameMask:=OptionalQMarksAtEnd(lFileNameMask);