Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not quoting $e->{'diagnosis'} before passing to qr #179

Closed
dzolnierz opened this issue Mar 22, 2016 · 4 comments
Closed

Not quoting $e->{'diagnosis'} before passing to qr #179

dzolnierz opened this issue Mar 22, 2016 · 4 comments
Assignees
Labels

Comments

@dzolnierz
Copy link

We're using Sisimai v4.15.0 in our internal tool to catch bouncing addresses and we've found that when remote MTA (Exim) bounces email with reason like this:

Diagnostic-Code: smtp; 550 Bad SPF records for
[newsletter-hub.com:77.55.92.138], see http://spf.pobox.com/

Our tool ends up with error:

Mar 13 15:30:55 bouncer5 bounceparser: Invalid [] range "r-h" in regex; marked by <-- HERE in m/550 Bad SPF records for [newsletter-h <-- HERE ub.com:212.182.125.16], see http://spf.pobox.com// at /usr/local/share/perl/5.20.2/Sisimai/MTA/Exim.pm line 404.

The line is:
my $rxdiagnosis = qr/$e->{'diagnosis'}/i;

The problem lies in treating r-h string in newsletter-hub.com domain like regex range. I think quoting $e->{'diagnosis'} before passing should help:

my $rxdiagnosis = qr/\Q$e->{'diagnosis'}\E/i;

But I am not sure this change would break something else.

@dzolnierz dzolnierz changed the title Not quoting $diagnosis before passing to qr Not quoting $e->{'diagnosis'} before passing to qr Mar 22, 2016
@azumakuniyuki
Copy link
Member

@dzolnierz Thanks for the bug report.
I've got the error message when parsing the following bounce message using Sisimai 4.17.0:

Status: 5.0.0
Remote-MTA: dns; 127.0.0.1
Diagnostic-Code: smtp; 550 Bad SPF records for [newsletter-hub.com:77.55.92.138], see http://spf.pobox.com/
% perl -MSisimai -lE 'print Sisimai->dump(shift)' ./exim-28.eml
Invalid [] range "r-h" in regex; marked by <-- HERE in m/550 Bad SPF records for [newsletter-h <-- HERE ub.com:77.55.92.138], see http://spf.pobox.com// at /usr/local/lib/perl5/site_perl/5.22.1/Sisimai/MTA/Exim.pm line 387, <GEN0> line 53.

I'll try to fix the bug from tonight.

@azumakuniyuki azumakuniyuki self-assigned this Mar 23, 2016
@azumakuniyuki azumakuniyuki added this to the v4.17.1 Release milestone Mar 23, 2016
@dzolnierz
Copy link
Author

Thanks, I look forward to seeing the fix.

@dzolnierz
Copy link
Author

We have updated Sisiami to version 4.17.0p1 and all messages parsed smoothly. Many thanks.

@azumakuniyuki
Copy link
Member

@dzolnierz Good news ! Thank you again for the bug report. This issue will be closed after the porting to the Ruby version of Sisimai.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants