Mis-used string pointers in opendkim.c and vbr.c #244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enhanced warnings in Debian and Fedora build logs expose some string addressing problems in vbr.c and opendkim.c.
In two snprintf() calls the size of the buffer pointer is mistakenly used instead of the size of the buffer itself, resulting in a truncated error message. There is already a static function vbr_error() which can safely replace snprintf here.
https://kojipkgs.fedoraproject.org//packages/opendkim/2.11.0/0.42.fc43/data/logs/x86_64/build.log
The code is trying to return an error if mctx_domain is an empty string. 'mctx_domain' is the string buffer itself, not a malloced pointer to it, so the code should be looking for "mctx_domain[0] == '\0'". This bug means later code uses the possibly empty string assuming it's not empty, so it should be fixed even without a failing test case.