Parcourir la source

FIX: Don't allow a control codes in the file names under Windows (fixes #2285)

Alexander Koblov il y a 9 mois
Parent
commit
e2a810c962
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      components/doublecmd/dcstrutils.pas

+ 3 - 3
components/doublecmd/dcstrutils.pas

@@ -3,7 +3,7 @@
    -------------------------------------------------------------------------
    Useful functions dealing with strings.
    
-   Copyright (C) 2006-2023  Alexander Koblov ([email protected])
+   Copyright (C) 2006-2025  Alexander Koblov ([email protected])
    Copyright (C) 2012       Przemyslaw Nagay ([email protected])
 
    This program is free software; you can redistribute it and/or modify
@@ -650,7 +650,7 @@ end;
 function ReplaceInvalidChars(const FileName: String): String;
 const
 {$IFDEF MSWINDOWS}
-  ForbiddenChars : set of char = ['<','>',':','"','/','|','?','*'];
+  ForbiddenChars : set of char = [#00..#31, '<','>',':','"','/','|','?','*'];
 {$ELSE}
   ForbiddenChars : set of char = [#0];
 {$ENDIF}
@@ -671,7 +671,7 @@ end;
 function RemoveInvalidCharsFromFileName(const FileName: String): String;
 const
 {$IFDEF MSWINDOWS}
-  ForbiddenChars : set of char = ['<','>',':','"','/','\','|','?','*'];
+  ForbiddenChars : set of char = [#00..#31, '<','>',':','"','/','\','|','?','*'];
 {$ELSE}
   ForbiddenChars : set of char = ['/'];
 {$ENDIF}