Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryanli <yanli@yanli-laptop.(none)>2011-12-07 10:17:36 +0400
committeryanli <yanli@yanli-laptop.(none)>2011-12-07 10:17:36 +0400
commit8686070e2a3cc1139b80370ba14f34a9d6d8b901 (patch)
tree35b644d17892993e89d99dce65fb29cfb96b90e3 /library.c
parenta6477554e1fa1940575a4fb6e0efe4d10f66c825 (diff)
fix infinite loop on socket error
Diffstat (limited to 'library.c')
-rw-r--r--library.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/library.c b/library.c
index 1a6e79f1..80b028a0 100644
--- a/library.c
+++ b/library.c
@@ -113,6 +113,11 @@ PHPAPI char *redis_sock_read_bulk_reply(RedisSock *redis_sock, int bytes TSRMLS_
while(offset < bytes) {
got = php_stream_read(redis_sock->stream, reply + offset, bytes-offset);
+ if (got <= 0) {
+ /* Error or EOF */
+ zend_throw_exception_ex(redis_exception_ce, 0 TSRMLS_CC, "socket error \n");
+ break;
+ }
offset += got;
}
for(i = 0; i < 2; i++) {