Skip to content
Snippets Groups Projects
Commit 536a74fb authored by Nigel Kukard's avatar Nigel Kukard
Browse files

We need at least 4 bytes len, else throw Exception

Change-Id: If27513b09adafc1fa1a05ea7295c92b91d097367
parent 7d615d41
No related branches found
Tags v0.1.0
No related merge requests found
...@@ -58,7 +58,6 @@ class Net_EPP_Protocol { ...@@ -58,7 +58,6 @@ class Net_EPP_Protocol {
throw new exception('Timeout while reading from EPP Server'); throw new exception('Timeout while reading from EPP Server');
} }
} }
// Check for timeout // Check for timeout
if ($info['timed_out']) { if ($info['timed_out']) {
throw new Exception('Timeout while reading data from socket'); throw new Exception('Timeout while reading data from socket');
...@@ -115,6 +114,9 @@ class Net_EPP_Protocol { ...@@ -115,6 +114,9 @@ class Net_EPP_Protocol {
static function getFrame($socket) { static function getFrame($socket) {
// Read header // Read header
$hdr = Net_EPP_Protocol::_fread_nb($socket,4); $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 // Unpack first 4 bytes which is our length
$unpacked = unpack('N', $hdr); $unpacked = unpack('N', $hdr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment