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

fix segfault when server address is unknown #21

Merged
merged 3 commits into from
Nov 3, 2016
Merged

Conversation

Milek7
Copy link
Contributor

@Milek7 Milek7 commented Nov 2, 2016

No description provided.

@jcbf jcbf added the bug label Nov 2, 2016
@jcbf
Copy link
Owner

jcbf commented Nov 3, 2016

Can you just add a log entry ?

@jcbf
Copy link
Owner

jcbf commented Nov 3, 2016

Do you know under what conditions that variable is NULL ? Is it reproducible ?

I was wondering. If we don't have a ip address , SPF checking doesn't make any sense....

We should have a mechanism to prevent further processing.

@Milek7
Copy link
Contributor Author

Milek7 commented Nov 3, 2016

I was wondering. If we don't have a ip address , SPF checking doesn't make any sense....

Yes, that's why it returns SMFIS_ACCEPT. Message won't be further processed.

Do you know under what conditions that variable is NULL ? Is it reproducible ?

Milter documentation says that "NULL if the type is not supported in the current version or if the SMTP connection is made via stdin.", but I observed it when connection is closed before Postfix handles it. In postfix logs it shows as "connect from unknown[unknown]".
postfix log:

postfix/smtpd[30805]: connect from unknown[unknown]
postfix/smtpd[30805]: warning: milter unix:private/smfs: can't read SMFIC_CONNECT reply packet header: Success
postfix/smtpd[30805]: lost connection after CONNECT from unknown[unknown]
postfix/smtpd[30805]: disconnect from unknown[unknown] commands=0/0

dmesg:

smf-spf[19875]: segfault at 0 ip 0000000000402c9e sp 00007f93c7122ce0 error 4 in smf-spf[400000+5000]

disassembly near 402c9e:

  402c8b:       48 83 c1 01             add    $0x1,%rcx
  402c8f:       40 88 79 ff             mov    %dil,-0x1(%rcx)
  402c93:       40 84 ff                test   %dil,%dil
  402c96:       75 dc                   jne    402c74 <__ctype_b_loc@plt+0x1064>
  402c98:       48 89 f0                mov    %rsi,%rax
  402c9b:       c6 00 00                movb   $0x0,(%rax)
  402c9e:       0f b7 02                movzwl (%rdx),%eax
  402ca1:       66 83 f8 02             cmp    $0x2,%ax
  402ca5:       0f 84 9d 01 00 00       je     402e48 <__ctype_b_loc@plt+0x1238>
  402cab:       66 83 f8 0a             cmp    $0xa,%ax
  402caf:       0f 84 73 01 00 00       je     402e28 <__ctype_b_loc@plt+0x1218>
  402cb5:       48 83 3d 43 27 20 00    cmpq   $0x0,0x202743(%rip)        # 605400 <stderr@@GLIBC_2.2.5+0xa0>
  402cbc:       00

@jcbf jcbf merged commit db7c047 into jcbf:master Nov 3, 2016
@jcbf
Copy link
Owner

jcbf commented Nov 3, 2016

Thanks for the feedback and for the patch.

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

Successfully merging this pull request may close these issues.

2 participants