فهرست منبع

Add missing ValidateAndCombinePath call to the SetFileAttributes handler. This should make it possible to remove the Get/SetCurrentDir calls.

Martijn Laan 3 ماه پیش
والد
کامیت
45053d7f16
1فایلهای تغییر یافته به همراه8 افزوده شده و 1 حذف شده
  1. 8 1
      Projects/Src/Compression.SevenZipDecoder.pas

+ 8 - 1
Projects/Src/Compression.SevenZipDecoder.pas

@@ -115,7 +115,14 @@ end;
 
 function __SetFileAttributesW(lpFileName: LPCWSTR; dwFileAttributes: DWORD): BOOL; cdecl;
 begin
-  Result := SetFileAttributesRedir(State.DisableFsRedir, lpFileName, dwFileAttributes);
+  { See above }
+  var ExpandedFileName: String;
+  if ValidateAndCombinePath(State.ExpandedDestDir, lpFileName, ExpandedFileName) then
+    Result := SetFileAttributesRedir(State.DisableFsRedir, ExpandedFileName, dwFileAttributes)
+  else begin
+    Result := False;
+    SetLastError(ERROR_ACCESS_DENIED);
+  end;
 end;
 
 function __SetFilePointer(hFile: THandle; lDistanceToMove: Longint;