Sfoglia il codice sorgente

Disallow length parameter <= 0 for Connection::readBytes.

Daniele Alessandri 15 anni fa
parent
commit
958c0a3b33
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      lib/Predis.php

+ 3 - 0
lib/Predis.php

@@ -906,6 +906,9 @@ class Connection implements IConnection {
     }
 
     public function readBytes($length) {
+        if ($length == 0) {
+            throw new InvalidArgumentException('Length parameter must be greater than 0');
+        }
         $socket = $this->getSocket();
         $value  = '';
         do {