diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-12 10:42:44 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-12 10:44:51 +0100 |
commit | 13659ea7caeb1410022035e34fdd8023359c3e54 (patch) | |
tree | 1a30c76c53a34b9e0f0037e8dd4d29595b7036e9 /contrib/hiredis/async.c | |
parent | 2dc402a80ceb3bcd7005fd1405c8bffbfdd3e598 (diff) | |
download | rspamd-13659ea7caeb1410022035e34fdd8023359c3e54.tar.gz rspamd-13659ea7caeb1410022035e34fdd8023359c3e54.zip |
[Minor] Fix another hiredis issue with uninitialized access
Diffstat (limited to 'contrib/hiredis/async.c')
-rw-r--r-- | contrib/hiredis/async.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/hiredis/async.c b/contrib/hiredis/async.c index 342b4838a..a508036e6 100644 --- a/contrib/hiredis/async.c +++ b/contrib/hiredis/async.c @@ -608,7 +608,7 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void cstr += pvariant; clen -= pvariant; - if (hasnext && strncasecmp(cstr,"subscribe\r\n",11) == 0) { + if (hasnext && clen >= 11 && strncasecmp(cstr,"subscribe\r\n",11) == 0) { c->flags |= REDIS_SUBSCRIBED; /* Add every channel/pattern to the list of subscription callbacks. */ @@ -621,7 +621,7 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void if (ret == 0) sdsfree(sname); } - } else if (strncasecmp(cstr,"unsubscribe\r\n",13) == 0) { + } else if (clen >= 13 && strncasecmp(cstr,"unsubscribe\r\n",13) == 0) { /* It is only useful to call (P)UNSUBSCRIBE when the context is * subscribed to one or more channels or patterns. */ if (!(c->flags & REDIS_SUBSCRIBED)) return REDIS_ERR; @@ -629,7 +629,7 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void /* (P)UNSUBSCRIBE does not have its own response: every channel or * pattern that is unsubscribed will receive a message. This means we * should not append a callback function for this command. */ - } else if(strncasecmp(cstr,"monitor\r\n",9) == 0) { + } else if(clen >= 9 && strncasecmp(cstr,"monitor\r\n",9) == 0) { /* Set monitor flag and push callback */ c->flags |= REDIS_MONITORING; __redisPushCallback(&ac->replies,&cb); |