increment/decrement can erroneously report MEMCACHED_UNKNOWN_READ_FAILURE
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmemcached |
Fix Released
|
Medium
|
Brian Aker |
Bug Description
When calling down into the increment and decrement functions, the response parsing code makes a call to strtoull without resetting errno [1] to zero first. Failing to initialize errno can ultimately cause a value of EINVAL to propagate across the function call, invoke the error handler, and the library will return MEMCACHED_
This will be observed by consumers of the library as MEMCACHED_
This issue was introduced in libmemcached-1.0.3, and exists in the latest version in the 1.0 branch, libmemcached-
To fix this issue, make sure errno is set to zero before calling strtoull.
To test for this issue, set errno to EINVAL before calling memcached_increment and observe an incorrect return value of MEMCACHED_
[1] http://
Related branches
- Tangent Trunk: Pending requested
-
Diff: 287 lines (+48/-50)10 files modifiedexample/include.am (+1/-1)
libmemcached/common.h (+8/-1)
libmemcached/connect.cc (+3/-10)
libmemcached/connect.hpp (+0/-2)
libmemcached/get.cc (+2/-2)
libmemcached/instance.cc (+0/-5)
libmemcached/stats.cc (+2/-2)
libmemcached/string.cc (+13/-8)
libmemcached/version.cc (+15/-15)
libtest/comparison.hpp (+4/-4)
Changed in libmemcached: | |
milestone: | none → 1.0.17 |
assignee: | nobody → Brian Aker (brianaker) |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in libmemcached: | |
status: | In Progress → Fix Released |
Thanks.