From 3cda4919d139b3b4c12344db5b0ba00e20ffffef Mon Sep 17 00:00:00 2001 From: Daniel Kouril Date: Thu, 5 Sep 2019 09:57:04 +0200 Subject: [PATCH] Avoid using uninitialized array offsets --- src/managers/VulnerabilitiesManager.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/managers/VulnerabilitiesManager.php b/src/managers/VulnerabilitiesManager.php index f8abadb0..59c32171 100644 --- a/src/managers/VulnerabilitiesManager.php +++ b/src/managers/VulnerabilitiesManager.php @@ -138,8 +138,8 @@ private function dpkgvercmp_in($a, $b) $first_diff = 0; while (($i < $l && !ctype_digit($a[$i])) || ($j < $k && !ctype_digit($b[$j]))) { - $vc = $this->order($a[$i]); - $rc = $this->order($b[$j]); + $vc = ($i < $l) ? $this->order($a[$i]) : 0; + $rc = ($j < $k) ? $this->order($b[$j]) : 0; if ($vc != $rc) { return $vc - $rc; } @@ -186,9 +186,6 @@ private function dpkgvercmp_in($a, $b) */ private function order($val) { - if ($val == '') { - return 0; - } if ($val == '~') { return -1; }