if (key)
{
- strncpy(key, result_buffer->key, result_buffer->key_length);
+ if (result_buffer->key_length > MEMCACHED_MAX_KEY)
+ {
+ *error= MEMCACHED_KEY_TOO_BIG;
+ *value_length= 0;
+
+ return NULL;
+ }
+ strncpy(key, result_buffer->item_key, result_buffer->key_length); // For the binary protocol we will cut off the key :(
*key_length= result_buffer->key_length;
}
- if (result_buffer->flags)
- *flags= result_buffer->flags;
- else
- *flags= 0;
+ *flags= result_buffer->item_flags;
return memcached_string_c_copy(&result_buffer->value);
}
if ((result= memcached_result_create(ptr, NULL)) == NULL)
return NULL;
- while ((server = memcached_io_get_readable_server(ptr)) != NULL)
+ while ((server= memcached_io_get_readable_server(ptr)) != NULL)
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
*error= memcached_response(server, buffer, sizeof(buffer), result);
{
memcached_result_st *result= &ptr->result;
memcached_return_t rc= MEMCACHED_FAILURE;
- unsigned int x;
while ((result= memcached_fetch_result(ptr, result, &rc)) != NULL)
{
if (rc == MEMCACHED_SUCCESS)
{
- for (x= 0; x < number_of_callbacks; x++)
+ for (uint32_t x= 0; x < number_of_callbacks; x++)
{
rc= (*callback[x])(ptr, result, context);
if (rc != MEMCACHED_SUCCESS)