summaryrefslogtreecommitdiff
path: root/hiredis.c
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2020-06-07 14:38:16 -0700
committerGitHub <noreply@github.com>2020-06-07 14:38:16 -0700
commit6448f735d5663c7c58aa269d8f53f06c4640ef5a (patch)
treea7d050ffe5f41cda3b51864a4c612abcd989850c /hiredis.c
parentc7267235455f48e7ce4aa5cb1d0bc0cfe2b7ba09 (diff)
sdsrange overflow fix (#830)
Fix overflow bug in `sdsrange`
Diffstat (limited to 'hiredis.c')
-rw-r--r--hiredis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hiredis.c b/hiredis.c
index 3133716..4487134 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -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;
}
}
}