From c5e9827dedc16213fb7408311fb7a37a4f0bec6b Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Sun, 30 Jun 2019 13:04:58 -0700
Subject: [PATCH] Properly check length of packet

---
 srb2query.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srb2query.php b/srb2query.php
index 94cdaeb..0d39ff5 100644
--- a/srb2query.php
+++ b/srb2query.php
@@ -386,7 +386,7 @@ class SRB2Query
 		// I can get away with just 'minimum' for now because there aren't any
 		// variable length packets in array format. That sounds stupid anyway.
 		$n = $n * $pkf['minimum'];
-		if ($n > strlen($pk['buffer']))
+		if ($n + $pkf['minimum'] > strlen($pk['buffer']))
 			return FALSE;
 		$t = unpack($pkf['format'], $pk['buffer'], $n);
 		if (isset($pkf['strings']))
-- 
GitLab