From 712111422ab096f900c10572b3c7294d023cefa4 Mon Sep 17 00:00:00 2001 From: "SilverAg.L" Date: Mon, 5 Jan 2026 23:06:11 +0800 Subject: [PATCH] chbg: avoid the TOCTOU race --- bin/chbg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/chbg b/bin/chbg index 5404393..93be32b 100755 --- a/bin/chbg +++ b/bin/chbg @@ -14,7 +14,7 @@ finput=$1 read -r fw fh <<< "$fsize" (( fw > 3840 && fh > 2160 )) && { - finput="$(mktemp --dry-run).webp" + finput="$(mktemp "${TMPDIR:-/tmp}/chbg.XXXXXXXX.webp")" trap 'rm -f "$finput"' EXIT echo "WARNING: image too large, resizing ..." # echo "DEBUG: resized image at $finput"