#2711 Squirrelmail timeouts on email with bad headers

Produces PHP errors
Folders (317)

If a user receives an email with bad headers syntax (typically a UTF8 character directly in Subject, From or To header without MIME encoded-word syntax (RFC 2047)), SquirrelMail 1.4.20 is unable to display the list of emails in the folder and it usually timeouts with php error "execution time exceeded 30s". I know these emails are against RFC standards, but these simply arrive sometimes, and it shouldn't block the user's entire mailbox. Squirrelmail 1.4.20-RC2 handles these improperly formatted email correctly, with no timeouts or slow-downs.

A typical email that causes this problem is attached.


<< < 1 2 3 4 .. 6 > >> (Page 2 of 6)

  • Anonymous

    • status: pending-works-for-me --> open-works-for-me

  • Anonymous

    I forgot again. Following locales are installed on the server

    cs_CZ ISO-8859-2
    cs_CZ.UTF-8 UTF-8
    en_US.ISO-8859-15 ISO-8859-15
    en_US.UTF-8 UTF-8

    Plus there is a typo in the address for configtest output of 1.4.20-RC2 (the last version that works for us), it is

    Thank you.

  • I still cannot find any problems here. Can you please indicate how big the mailbox is where this is happening? Are there lots of messages? If you put the example message into a folder with just a few other messages, does the problem go away?

    Your original report, you say that the timeout coincides with a PHP error indicating the problem. You need to show the full text of that error message in order to help pinpoint the problem.

    You can also try the debugging lines that I suggested earlier, if you're comfortable with digging in the source. Also, please explain any language/encoding related settings you've made in SquirrelMail's configuration file.

    Thank you.


  • Anonymous

    Thank you again for your help. Currently no error is displayed in the web browser, but there are errors in the logs:

    PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/squirrelmail-1.4.20/functions/strings.php on line 1245, referer: https://webmail.jh-inst.cas.cz/stable/src/left_main.php

    Will this help? Thank you!

  • 1) Please answer the other questions I asked.

    2) Line 1245 in vanilla 1.4.20 is this: function sq_lowercase_array_vals(&$val,$key) {
    It is unlikely that this is the timeout location. Please show what line 1245 looks like for you and explain why your copy of SquirrelMail is modified - show all modifications you've made.


  • Anonymous

    Sorry. The problem does not depend on the amount of messages in the folder, I can reproduce it with a single-message mailbox. I haven't modified the SM source files, I don't understand PHP.

    Lines 1245-1247 are

    function sq_lowercase_array_vals(&$val,$key) {
    $val = strtolower($val);

    In 1.4.21-svn-20100414 the same problem occurs, PHP error is

    PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/squirrelmail-1.4.21-svn-20100414/functions/strings.php on line 1182, referer: https://webmail.jh-inst.cas.cz/testing/src/left_main.php

    line 1182 in this version is


    So the problem really seems to be with the sq_lowercase_array_vals function?

  • Even if you put the email in a folder with nothing else, how big is the *INBOX* for your test account? Is it small, too?

    How busy is the server? What is its load? How many users are accessing it?


  • Anonymous

    New account, just the one problematic email in INBOX. Server is running two quad-core Intel Xeons E5335 (8 cores together), average load 0.5. The server is not overloaded, the problem does not appear with SM 1.4.20-rc2 and older.


  • Anonymous

    Thank you. Unfortunatelly the patch did not help, just the error changed so it timeouts on another line in the PHP code:

    PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/squirrelmail-1.4.20/functions/strings.php on line 884, referer: https://webmail.jh-inst.cas.cz/stable/src/left_main.php

    line 884 is

    function sq_strpos($haystack, $needle, $offset=0, $charset='auto')

<< < 1 2 3 4 .. 6 > >> (Page 2 of 6)