From 536a74fbd7e5483ad4c400e1a4a6dddfb99968a4 Mon Sep 17 00:00:00 2001 From: Nigel Kukard <nkukard@lbsd.net> Date: Tue, 10 Sep 2013 12:41:31 +0000 Subject: [PATCH] We need at least 4 bytes len, else throw Exception Change-Id: If27513b09adafc1fa1a05ea7295c92b91d097367 --- modules/registrars/cozaepp/Net/EPP/Protocol.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/registrars/cozaepp/Net/EPP/Protocol.php b/modules/registrars/cozaepp/Net/EPP/Protocol.php index ae2d694..8c07df9 100644 --- a/modules/registrars/cozaepp/Net/EPP/Protocol.php +++ b/modules/registrars/cozaepp/Net/EPP/Protocol.php @@ -58,7 +58,6 @@ class Net_EPP_Protocol { throw new exception('Timeout while reading from EPP Server'); } } - // Check for timeout if ($info['timed_out']) { throw new Exception('Timeout while reading data from socket'); @@ -115,6 +114,9 @@ class Net_EPP_Protocol { static function getFrame($socket) { // Read header $hdr = Net_EPP_Protocol::_fread_nb($socket,4); + if (strlen($hdr) < 4) { + throw new Exception(sprintf('Short read of %d bytes from peer', strlen($hdr))); + } // Unpack first 4 bytes which is our length $unpacked = unpack('N', $hdr); -- GitLab