Skip to content

Commit

Permalink
Merge pull request #4527 from corentin-soriano/fix_file_overwrite
Browse files Browse the repository at this point in the history
Fix file overwrite when older file exists with same md5 checksum.
  • Loading branch information
nilsteampassnet authored Dec 21, 2024
2 parents e5e220f + fe8c06e commit 114e7ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sources/main.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2466,7 +2466,7 @@ function encryptFile(string $fileInName, string $fileInPath): array

// Save new file
// deepcode ignore InsecureHash: is simply used to get a unique name
$hash = md5($plaintext);
$hash = uniqid('', true);
$fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash;
file_put_contents($fileOut, $ciphertext);
unlink($fileInPath . '/' . $fileInName);
Expand Down

0 comments on commit 114e7ff

Please sign in to comment.