diff options
author | antirez <antirez@gmail.com> | 2019-12-29 15:40:40 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2019-12-29 15:40:40 +0100 |
commit | 5521910de77d8a9d7587ec8497cc589c4245a599 (patch) | |
tree | ed088adbb3a217f0d761b51bfb8f6eaab7d0f30c | |
parent | 324e22accf457edc996971bc97f5474349cd7c4c (diff) | |
download | redis-5521910de77d8a9d7587ec8497cc589c4245a599.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.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/networking.c b/src/networking.c index 37f8fa9b7..dac45751d 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1453,12 +1453,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; |