From: Brian Aker Date: Sat, 22 Dec 2007 01:26:25 +0000 (-0800) Subject: Fixed a bug Cal found on null termination of a result for memcached_fetch() X-Git-Tag: 0.13~16 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=73f36e452580ef9be36d3d89985c25e0d33e4a2d;p=awesomized%2Flibmemcached Fixed a bug Cal found on null termination of a result for memcached_fetch() --- diff --git a/ChangeLog b/ChangeLog index 68671ae4..a8e87a7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ * If memcached_server_list_append is passed NULLs instead of pointers it returns NULL. * Added memcached_fetch_execute() method + * Found a bug where memcached_fetch() was not null terminating the result + value. 0.12 Tue Dec 11 15:20:55 PST 2007 * Updates for consistent hashing diff --git a/configure.ac b/configure.ac index f052f5f0..0cf13db9 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ MEMCACHED_LIBRARY_NAME=libmemcached #release versioning MEMCACHED_MAJOR_VERSION=0 -MEMCACHED_MINOR_VERSION=12 +MEMCACHED_MINOR_VERSION=13 MEMCACHED_MICRO_VERSION=0 #API version diff --git a/lib/memcached_string.c b/lib/memcached_string.c index 300f10f2..247fbe47 100644 --- a/lib/memcached_string.c +++ b/lib/memcached_string.c @@ -129,11 +129,12 @@ char *memcached_string_c_copy(memcached_string_st *string) WATCHPOINT_ASSERT(string->is_allocated != MEMCACHED_USED); - c_ptr= (char *)malloc(memcached_string_length(string) * sizeof(char)); + c_ptr= (char *)malloc((memcached_string_length(string)+1) * sizeof(char)); if (!c_ptr) return NULL; memcpy(c_ptr, memcached_string_value(string), memcached_string_length(string)); + c_ptr[memcached_string_length(string)]= 0; return c_ptr; }