Browse Source

Protection against non-existant $msort to fix Debian Bug ##127104.

Bron Gondwana 23 years ago
parent
commit
3f90cb6969
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/read_body.php

+ 6 - 0
src/read_body.php

@@ -35,6 +35,9 @@ function findNextMessage() {
             $result = $currentArrayIndex - 1;
         }
     } else {
+        if (!is_array($msort)) {
+            return -1;
+        }
         for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
             if ($currentArrayIndex == $msgs[$key]['ID']) {
                 next($msort);
@@ -70,6 +73,9 @@ function findPreviousMessage() {
             $result = $currentArrayIndex + 1;
         }
     } else {
+	if (!is_array($msort)) {
+            return -1;
+	}
         for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) {
             if ($currentArrayIndex == $msgs[$key]['ID']) {
                 prev($msort);