File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -181,14 +181,20 @@ PHP_MSHUTDOWN_FUNCTION(file) /* {{{ */
181181}
182182/* }}} */
183183
184+ static inline bool php_is_valid_flock_flag (zend_long s ) {
185+ const zend_long sb = s & ~PHP_LOCK_NB ;
186+ return (sb == PHP_LOCK_UN || sb == PHP_LOCK_SH ||
187+ sb == PHP_LOCK_EX || s == -1 );
188+ }
189+
184190PHPAPI void php_flock_common (php_stream * stream , zend_long operation ,
185191 uint32_t operation_arg_num , zval * wouldblock , zval * return_value )
186192{
187193 int flock_values [] = { LOCK_SH , LOCK_EX , LOCK_UN };
188194 int act ;
189195
190196 act = operation & PHP_LOCK_UN ;
191- if (act < 1 || act > 3 ) {
197+ if (act < 1 || act > 3 || ! php_is_valid_flock_flag ( operation ) ) {
192198 zend_argument_value_error (operation_arg_num , "must be one of LOCK_SH, LOCK_EX, or LOCK_UN" );
193199 RETURN_THROWS ();
194200 }
You can’t perform that action at this time.
0 commit comments