File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,19 @@ zend_bool s_memc_valid_key_binary(zend_string *key)
230230 return memchr (ZSTR_VAL (key ), '\n' , ZSTR_LEN (key )) == NULL ;
231231}
232232
233+ static
234+ uint32_t s_memc_object_key_max_length (php_memc_object_t * intern ) {
235+ memcached_return retval ;
236+ char * result ;
237+
238+ result = memcached_callback_get (intern -> memc , MEMCACHED_CALLBACK_PREFIX_KEY , & retval );
239+ if (retval == MEMCACHED_SUCCESS && result ) {
240+ return MEMC_OBJECT_KEY_MAX_LENGTH - strlen (result );
241+ } else {
242+ return MEMC_OBJECT_KEY_MAX_LENGTH ;
243+ }
244+ }
245+
233246static
234247zend_bool s_memc_valid_key_ascii (zend_string * key )
235248{
@@ -245,7 +258,7 @@ zend_bool s_memc_valid_key_ascii(zend_string *key)
245258
246259#define MEMC_CHECK_KEY (intern , key ) \
247260 if (UNEXPECTED(ZSTR_LEN(key) == 0 || \
248- ZSTR_LEN(key) > MEMC_OBJECT_KEY_MAX_LENGTH || \
261+ ZSTR_LEN(key) > s_memc_object_key_max_length(intern) || \
249262 (memcached_behavior_get(intern->memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) \
250263 ? !s_memc_valid_key_binary(key) \
251264 : !s_memc_valid_key_ascii(key) \
You can’t perform that action at this time.
0 commit comments