Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a24fa53

Browse files
Don't allow negative timeout values
1 parent fcea71f commit a24fa53

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

redis_session.c

+9
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,15 @@ PS_OPEN_FUNC(rediscluster) {
525525
session_conf_timeout(ht_conf, "timeout", sizeof("timeout"), &timeout);
526526
session_conf_timeout(ht_conf, "read_timeout", sizeof("read_timeout"), &read_timeout);
527527

528+
/* Sanity check on our timeouts */
529+
if (timeout < 0 || read_timeout < 0) {
530+
php_error_docref(NULL TSRMLS_CC, E_WARNING,
531+
"Can't set negative timeout values in session configuration");
532+
zval_dtor(z_conf);
533+
efree(z_conf);
534+
return FAILURE;
535+
}
536+
528537
/* Look for a specific prefix */
529538
if (zend_hash_find(ht_conf, "prefix", sizeof("prefix"), (void**)&z_val) == SUCCESS &&
530539
Z_TYPE_PP(z_val) == IS_STRING && Z_STRLEN_PP(z_val) > 0)

0 commit comments

Comments
 (0)