Fixes for minor bugs pointed out by Tyler Akins.
[squirrelmail.git] / functions / file_prefs.php
index 8a4287eb0a1aa23a7513b212d726e09a97cd103a..eadf3fad7ef75c08d474d10b09cae653742da0fc 100644 (file)
@@ -49,11 +49,14 @@ function cachePrefValues($data_dir, $username) {
     /* Read in the preferences. */
     $highlight_num = 0;
     while (! feof($file)) {
-        $pref = trim(fgets($file, 1024));
+        // Make sure that this fgets is larger than any of the pref strings
+        // could ever be.  1024 is too short
+        $pref = trim(fgets($file, 65536));
         $equalsAt = strpos($pref, '=');
         if ($equalsAt > 0) {
             $key = substr($pref, 0, $equalsAt);
             $value = substr($pref, $equalsAt + 1);
+            /* this is to 'rescue' old-style highlighting rules. */
             if (substr($key, 0, 9) == 'highlight') {
                 $key = 'highlight' . $highlight_num;
                 $highlight_num ++;