summaryrefslogtreecommitdiff
path: root/items.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2020-11-12 16:35:13 -0800
committerdormando <dormando@rydia.net>2021-06-07 22:06:55 -0700
commitd0b560d91a3bf7b7cda93759c48b5319e9743911 (patch)
tree97ba7fa11a1135ebd4303846532a66639a530057 /items.c
parentf4aee656741421a41bc5e128f10e15be703c8927 (diff)
downloadmemcached-d0b560d91a3bf7b7cda93759c48b5319e9743911.tar.gz
meta: protect cachedump from bin keys and add docs
cachedump was the only place in the codebase I can find which copied the key verbatim. wonder when I can finally remove the command :)
Diffstat (limited to 'items.c')
-rw-r--r--items.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/items.c b/items.c
index 998f3a6..a5c85b7 100644
--- a/items.c
+++ b/items.c
@@ -614,7 +614,8 @@ char *item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, u
while (it != NULL && (limit == 0 || shown < limit)) {
assert(it->nkey <= KEY_MAX_LENGTH);
- if (it->nbytes == 0 && it->nkey == 0) {
+ // protect from printing binary keys.
+ if ((it->nbytes == 0 && it->nkey == 0) || (it->it_flags & ITEM_KEY_BINARY)) {
it = it->next;
continue;
}