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

Segfault while using "Minimum 100%" in opendkim.conf #222

Open
andreasschulze opened this issue Aug 24, 2024 · 2 comments
Open

Segfault while using "Minimum 100%" in opendkim.conf #222

andreasschulze opened this issue Aug 24, 2024 · 2 comments

Comments

@andreasschulze
Copy link

The config option "Minimum" can be set to "100%". Rationale: I do not want partial signed messages.
This setting worked well until someone sent a message with no body at all. Then, OpenDKIM fail.

The reason is probably this code

pct = (100 * canonlen) / bodylen;
if (pct < "100")
	status = DKIMF_STATUS_PARTIAL;

no body mean bodylen == 0 -> division by zero -> boom
(but it's not verified by a debugger or stack trace)

Fortunately, the code allow other ways to express the same "I do not want partial signed messages":

  • "Minimum" can be set to "0+" which allow no more the 0 unsigned bytes.
  • "Minimum" can be set to an huge number larger then any maximum message size which require "all" must be signed
@futatuki
Copy link

In develop branch, the variable name pct has been changed to signpct but it contains same logic. Also I could confirm that it causes "SIGFPE, Arithmetic exception. Integer divide by zero.".

I think in the case bodylen == 0 the status should not be DKIM_STATUS_PARTIAL.

futatuki added a commit to futatuki/OpenDKIM that referenced this issue Aug 24, 2024
…"Minimum" option is set.

* opendkim/opendkim.c (mlfi_eom)
futatuki added a commit to futatuki/OpenDKIM that referenced this issue Aug 24, 2024
@futatuki
Copy link

With the patch on PR #223, I could confirm the case I tried above does not cause exception.

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

No branches or pull requests

2 participants