diff options
author | yanli <yanli@yanli-laptop.(none)> | 2011-12-07 10:17:36 +0400 |
---|---|---|
committer | yanli <yanli@yanli-laptop.(none)> | 2011-12-07 10:17:36 +0400 |
commit | 8686070e2a3cc1139b80370ba14f34a9d6d8b901 (patch) | |
tree | 35b644d17892993e89d99dce65fb29cfb96b90e3 /library.c | |
parent | a6477554e1fa1940575a4fb6e0efe4d10f66c825 (diff) |
fix infinite loop on socket error
Diffstat (limited to 'library.c')
-rw-r--r-- | library.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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++) { |