From: Date: Mon, 30 Jun 2008 18:17:09 +0000 (-0700) Subject: Fix for prefix key checking in prefix X-Git-Tag: 0.22~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=528741ce60dfd864facfb338ef4de7c3cbcd00c5;p=m6w6%2Flibmemcached Fix for prefix key checking in prefix --- diff --git a/libmemcached/memcached_callback.c b/libmemcached/memcached_callback.c index ad1ce2b1..52afbb94 100644 --- a/libmemcached/memcached_callback.c +++ b/libmemcached/memcached_callback.c @@ -19,7 +19,11 @@ memcached_return memcached_callback_set(memcached_st *ptr, if (key) { - ptr->prefix_key_length= strlen(key); + size_t key_length= strlen(key); + + if ((ptr->flags & MEM_VERIFY_KEY) && (memcachd_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)) + return MEMCACHED_BAD_KEY_PROVIDED; + if ((ptr->prefix_key_length > MEMCACHED_PREFIX_KEY_MAX_SIZE -1) || (strcpy(ptr->prefix_key, key) == NULL)) {