driusan/dkim

dkimsign fails when stdin contains nothing

ThinkChaos opened this issue · 3 comments

I ran into this today when trying to send an empty email, dkimsign just fills up the RAM and ends up getting killed.
I gave a quick look at normalizeReader and FileBuffer but didn't spot the bug, EOF seems to be handled.

Here's a simple way to reproduce this:

dkimsign -d example.com -s default <<< ''

I was able to reproduce and the latest commit should fix this.

Shouldn't your empty email at least have a To: line? Regardless, we still shouldn't be getting into infinite loops that use up all the RAM..

You're right the email still had headers but I think the bug also triggered if the last line was empty!

EDIT: I can confirm it happened with an empty last line.

Thanks for the fix 😃