const char *key, size_t key_length,
time_t expiration)
{
- char buffer[21];
+ char expiration_buffer[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1];
+ int expiration_buffer_length= snprintf(expiration_buffer, sizeof(expiration_buffer), " %llu", (unsigned long long)expiration);
+ if (size_t(expiration_buffer_length) >= sizeof(expiration_buffer) or expiration_buffer_length < 0)
+ {
+ return memcached_set_error(*instance, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT,
+ memcached_literal_param("snprintf(MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH)"));
+ }
- int buffer_length= snprintf(buffer, sizeof(buffer), " %u", uint32_t(expiration));
struct libmemcached_io_vector_st vector[]=
{
{ memcached_literal_param("touch ") },
{ memcached_array_string(instance->root->_namespace), memcached_array_size(instance->root->_namespace) },
{ key, key_length },
- { buffer, buffer_length },
+ { expiration_buffer, expiration_buffer_length },
{ memcached_literal_param("\r\n") }
};
}
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- rc= memcached_read_one_response(instance, buffer, sizeof(buffer), NULL);
+ rc= memcached_response(instance, buffer, sizeof(buffer), NULL);
if (rc == MEMCACHED_SUCCESS or rc == MEMCACHED_NOTFOUND)
{