From 1176ccc0345e6c04b9eae9cdf71851fe05204f32 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Tue, 24 Feb 2026 21:16:50 +0100 Subject: fix(core): use mktemp for temporary output file creation Replaces $$.$RANDOM with mktemp, which provides cryptographically random names and atomic file creation. --- transcode.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transcode.sh b/transcode.sh index 500111d..a25bc6a 100755 --- a/transcode.sh +++ b/transcode.sh @@ -690,7 +690,9 @@ encode_one() { # Temp file is created in the same directory as the input so that `mv` is # atomic on the same filesystem (avoid cross-device rename issues). - tmp="$directory/.${stem}_$PRESET_NAME.$$.$RANDOM${extension:+.$extension}" + # mktemp provides cryptographically random names and atomic creation, + # unlike $$.$RANDOM which has limited entropy and is predictable. + tmp=$(mktemp -- "$directory/.${stem}_${PRESET_NAME}.XXXXXX${extension:+.$extension}") TMP_FILES+=("$tmp") debug "Temporary output path:" "$tmp" -- cgit v1.3.1