roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.83k stars 1.63k forks source link

winmail.dat attachment causes "An internal error has occurred." error when attempting to view the email message #9462

Closed stephansfourie closed 4 months ago

stephansfourie commented 4 months ago

In Roundcube version 1.6.6 a user is attempting to open an email which contains a winmail.dat attachment. They see an "An internal error has occurred." error in the message pane.

The Roundcube logs on the server reports the following:

`[22-May-2024 10:02:20 Africa/Johannesburg] PHP Fatal error: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /opt/roundcubemail-1.6.6/program/lib/Roundcube/rcube_message.php:1108 Stack trace:

0 /opt/roundcubemail-1.6.6/program/lib/Roundcube/rcube_message.php(875): rcube_message->tnef_decode()

1 /opt/roundcubemail-1.6.6/program/lib/Roundcube/rcube_message.php(129): rcube_message->parse_structure()

2 /opt/roundcubemail-1.6.6/program/actions/mail/show.php(63): rcube_message->__construct()

3 /opt/roundcubemail-1.6.6/program/include/rcmail.php(282): rcmail_action_mail_show->run()

4 /opt/roundcubemail-1.6.6/index.php(278): rcmail->action_handler()

5 {main}

thrown in /opt/roundcubemail-1.6.6/program/lib/Roundcube/rcube_message.php on line 1108`

I've attempted to disable 'tnef_decode' in the config by setting it to 'false' but that didn't help. No other errors are reported in other logs, eg. PHP, Apache etc.

The email opens normally in Thunderbird when downloading it and opening it.

pabzm commented 4 months ago

Can you provide us with the email that triggers this (stripped from personal information)? Or the attachment?

alecpl commented 4 months ago

It is related to this change https://github.com/roundcube/roundcubemail/commit/25214753cb5b480f828e9acb0463f70fbf8663b0 and the fact that PHP become stricter.

alecpl commented 4 months ago

I suspect that it happens when RTF to HTML conversion fails for any reason. Don't you see also "Failed to extract RTF/HTML content from TNEF attachment" in the log?

I think 6d8dd2c9a2c3f8 should prevent the fatal error from happening, but to fix the conversion error we'd need a sample message.