From cf71b82111e8e099b2667fc0126fe9624a1f69f7 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 4 Jun 2013 15:53:53 +0200 Subject: [PATCH] Binary safe dump of object content in redisLogObjectDebugInfo(). --- src/debug.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/debug.c b/src/debug.c index 2f62bedb..eb08c38d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -390,8 +390,11 @@ void redisLogObjectDebugInfo(robj *o) { redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount); if (o->type == REDIS_STRING && o->encoding == REDIS_ENCODING_RAW) { redisLog(REDIS_WARNING,"Object raw string len: %zu", sdslen(o->ptr)); - if (sdslen(o->ptr) < 4096) - redisLog(REDIS_WARNING,"Object raw string content: \"%s\"", (char*)o->ptr); + if (sdslen(o->ptr) < 4096) { + sds repr = sdscatrepr(sdsempty(),o->ptr,sdslen(o->ptr)); + redisLog(REDIS_WARNING,"Object raw string content: %s", repr); + sdsfree(repr); + } } else if (o->type == REDIS_LIST) { redisLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o)); } else if (o->type == REDIS_SET) {