The ping function previously accepted arbitrary user input and passed it to the exec function without any sanitization or validation, creating a command injection vulnerability. This commit adds input validation using filter_var to ensure that the address parameter is a valid IP address or hostname, and uses predefined command options to avoid passing user input directly to exec. Additionally, this commit simplifies the status return logic using a ternary operator.
Fix GH-112