summaryrefslogtreecommitdiff
path: root/async.c
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2015-01-05 12:13:32 -0500
committerMatt Stancliff <matt@genges.com>2015-01-05 16:52:08 -0500
commit6a00a4643baaa920b182eb65ee82d9b8c23e3134 (patch)
tree89a12550994dbeccb29cc98f2acafda5dbe3055c /async.c
parent0c9ff5bb030fd07706c39b3d4f28cef618dd8794 (diff)
Fix redisAppendCommand error result
Previously, redisvAppendCommand() would return OOM even with formatting errors. Now we use OTHER with an error string telling the user the error was formatting related, not memory related. This also fixes a potentially worse bug where were would pass error result of -1 as an actual length to another function taking an unsigned length, which would result in crash/overallocation/errors. Now for that case, we just return an error immediately and stop processing the command. Fixes #177
Diffstat (limited to 'async.c')
-rw-r--r--async.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/async.c b/async.c
index 5acd01c..84480bc 100644
--- a/async.c
+++ b/async.c
@@ -650,6 +650,11 @@ int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdat
int len;
int status;
len = redisvFormatCommand(&cmd,format,ap);
+
+ /* We don't want to pass -1 or -2 to future functions as a length. */
+ if (len < 0)
+ return REDIS_ERR;
+
status = __redisAsyncCommand(ac,fn,privdata,cmd,len);
free(cmd);
return status;