summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-12-29 15:40:40 +0100
committerantirez <antirez@gmail.com>2020-03-05 16:15:31 +0100
commit7569b210d6be5c76d5bfb3e1d35663859e735429 (patch)
treeba821655ee0565078c47d1958dfa65c1a370ba88
parent3c610b4e8d8d4b09254c5e1a435ca25b82710e38 (diff)
downloadredis-7569b210d6be5c76d5bfb3e1d35663859e735429.tar.gz
Inline protocol: handle empty strings well.
This bug is from the first version of Redis. Probably the problem here is that before we used an SDS split function that created empty strings for additional spaces, like in "SET foo bar". AFAIK later we replaced it with the curretn sdssplitarg() API that has no such a problem. As a result, we introduced a bug, where it is no longer possible to do something like: SET foo "" Using the inline protocol. Now it is fixed.
-rw-r--r--src/networking.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/networking.c b/src/networking.c
index e2af03d4e..59421e94d 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -1230,12 +1230,8 @@ int processInlineBuffer(client *c) {
/* Create redis objects for all arguments. */
for (c->argc = 0, j = 0; j < argc; j++) {
- if (sdslen(argv[j])) {
- c->argv[c->argc] = createObject(OBJ_STRING,argv[j]);
- c->argc++;
- } else {
- sdsfree(argv[j]);
- }
+ c->argv[c->argc] = createObject(OBJ_STRING,argv[j]);
+ c->argc++;
}
zfree(argv);
return C_OK;