diff options
author | Michael Grunder <michael.grunder@gmail.com> | 2020-06-07 14:38:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-07 14:38:16 -0700 |
commit | 6448f735d5663c7c58aa269d8f53f06c4640ef5a (patch) | |
tree | a7d050ffe5f41cda3b51864a4c612abcd989850c /hiredis.c | |
parent | c7267235455f48e7ce4aa5cb1d0bc0cfe2b7ba09 (diff) |
sdsrange overflow fix (#830)
Fix overflow bug in `sdsrange`
Diffstat (limited to 'hiredis.c')
-rw-r--r-- | hiredis.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -920,17 +920,17 @@ int redisBufferWrite(redisContext *c, int *done) { return REDIS_ERR; if (sdslen(c->obuf) > 0) { - int nwritten = c->funcs->write(c); + ssize_t nwritten = c->funcs->write(c); if (nwritten < 0) { return REDIS_ERR; } else if (nwritten > 0) { - if (nwritten == (signed)sdslen(c->obuf)) { + if (nwritten == (ssize_t)sdslen(c->obuf)) { sdsfree(c->obuf); c->obuf = sdsempty(); if (c->obuf == NULL) goto oom; } else { - sdsrange(c->obuf,nwritten,-1); + if (sdsrange(c->obuf,nwritten,-1) < 0) goto oom; } } } |