diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-07-26 15:51:11 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-07-26 15:51:11 +0100 |
commit | d12c1e0ae5fc9a4beca05d62166a41ef6e657203 (patch) | |
tree | fa7019dd890135f59f4c563e68c676a70d0bc883 /lib | |
parent | 27d6ad899f594bd9b79e54cdc5a3c17110f3b26c (diff) |
Backport https://github.com/mikel/mail/pull/405 to prevent stack overflow errors when parsing large mails with envelopes on memory limited systems.0.12.0.1hotfix/0.12.0.1
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mail_handler/backends/mail_extensions.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb index 322c49bb5..87d8710f7 100644 --- a/lib/mail_handler/backends/mail_extensions.rb +++ b/lib/mail_handler/backends/mail_extensions.rb @@ -46,6 +46,15 @@ module Mail self end + + def set_envelope_header + raw_string = raw_source.to_s + if match_data = raw_source.to_s.match(/\AFrom\s(#{TEXT}+)#{CRLF}/m) + set_envelope(match_data[1]) + self.raw_source = raw_string.sub(match_data[0], "") + end + end + end # A patched version of the parameter hash that handles nil values without throwing |