File tree 1 file changed +7
-1
lines changed
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) /* {{{ */
181
181
}
182
182
/* }}} */
183
183
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
+
184
190
PHPAPI void php_flock_common (php_stream * stream , zend_long operation ,
185
191
uint32_t operation_arg_num , zval * wouldblock , zval * return_value )
186
192
{
187
193
int flock_values [] = { LOCK_SH , LOCK_EX , LOCK_UN };
188
194
int act ;
189
195
190
196
act = operation & PHP_LOCK_UN ;
191
- if (act < 1 || act > 3 ) {
197
+ if (act < 1 || act > 3 || ! php_is_valid_flock_flag ( operation ) ) {
192
198
zend_argument_value_error (operation_arg_num , "must be one of LOCK_SH, LOCK_EX, or LOCK_UN" );
193
199
RETURN_THROWS ();
194
200
}
You can’t perform that action at this time.
0 commit comments