trusteddomainproject / OpenDKIM

Other
97 stars 52 forks source link

miltertest: Fix undefined behaviour in mt.eom_check() with MT_SMTPREPLY #58

Closed glts closed 4 years ago

glts commented 4 years ago

The MT_SMTPREPLY case in mt_eom_check prints two possibly-NULL char pointers via format string %s. This triggers undefined behaviour. On my machine, these pointers are printed as the string ‘(null)’. In any case this distorts the test result.

The attached patch fixes this by making sure the two char pointers ‘esc’ and ‘text’ are only passed to snprintf when they are not NULL.

martinbogo commented 4 years ago

Works, does not cause build or functional issues when tested. Merging.