Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Misc/layoutroot/safe_sleep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +9 to +13
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This security fix lacks test coverage. Given that this addresses a code injection vulnerability, tests should be added to verify that the script correctly rejects malicious inputs (e.g., strings with shell metacharacters, command substitutions) and accepts valid integer inputs. The repository has comprehensive test coverage in the Test/L0 directory for other components.

Copilot generated this review using guidance from repository custom instructions.

# try to use ping if available
if [ -x "$(command -v ping)" ]; then
ping -c $(( $1 + 1 )) 127.0.0.1 > /dev/null
Expand Down