mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
Fixed bug #60222 (time_nanosleep() does validate input params).
This commit is contained in:
parent
438a30f1e7
commit
7337a901b7
2 changed files with 24 additions and 0 deletions
|
@ -4467,6 +4467,15 @@ PHP_FUNCTION(time_nanosleep)
|
|||
return;
|
||||
}
|
||||
|
||||
if (tv_sec < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds value must be greater than 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (tv_nsec < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The nanoseconds value must be greater than 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_req.tv_sec = (time_t) tv_sec;
|
||||
php_req.tv_nsec = tv_nsec;
|
||||
if (!nanosleep(&php_req, &php_rem)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue