From 9f92ef7efe29bed86ed1d1e468d8ab1133fa4120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?= <76864299+Rudxain@users.noreply.github.com> Date: Fri, 12 Dec 2025 03:14:06 -0400 Subject: [PATCH] fix(safe_sleep): assert arg is int This blocks code-injection --- src/Misc/layoutroot/safe_sleep.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Misc/layoutroot/safe_sleep.sh b/src/Misc/layoutroot/safe_sleep.sh index 7b61c584ee9..4457657756e 100644 --- a/src/Misc/layoutroot/safe_sleep.sh +++ b/src/Misc/layoutroot/safe_sleep.sh @@ -6,6 +6,12 @@ if [ -x "$(command -v sleep)" ]; then exit 0 fi +# assert integer +if ! builtin printf %d "$1" &>/dev/null; then + echo "safe_sleep: invalid time interval ‘$1’" + exit 1 +fi + # try to use ping if available if [ -x "$(command -v ping)" ]; then ping -c $(( $1 + 1 )) 127.0.0.1 > /dev/null