diff --git a/src/Json/JsonProtocol.php b/src/Json/JsonProtocol.php index fafa32b..b865ae9 100644 --- a/src/Json/JsonProtocol.php +++ b/src/Json/JsonProtocol.php @@ -91,6 +91,9 @@ class JsonProtocol implements ProtocolInterface { // check for $this->prependSizeBytes if ($this->prependSizeBytes > 0) { + if (strlen($data) < $this->prependSizeBytes) { + return null; + } $len = $this->unpackSizeBytes($data); // if size is greater than data (i.e. incomplete) if ($len > strlen($data) - $this->prependSizeBytes) return null;