lib ignores the last character of the key prefix string

Bug #776354 reported by Teddy Grenman on 2011-05-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Brian Aker

Bug Description

Applies to libmemcached 0.49.

Setting a key prefix copies the original array into internal structures. Copying is complete
and well, however it seems the string structure is incorrectly initialized. I suspect the
culprit is memcached_strcpy() in libmemcached/array.c, near line 63:

62: array->root= memc;
63: array->size= str_length -1; // We don't count the NULL ending
64: memcpy(array->c_str, str, str_length);

str_length already excludes the terminating null?

Brian Aker (brianaker) wrote :

If your string length counts the null, then you will end up with a double null in the array.

Brian Aker (brianaker) on 2011-05-23
Changed in libmemcached:
assignee: nobody → Brian Aker (brianaker)
status: New → Fix Committed
importance: Undecided → High
Brian Aker (brianaker) on 2011-06-20
Changed in libmemcached:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers