Fix compiler warnings (-Wincompatible-pointer-types, -Wformat-truncation) - #360
Merged
thegushi merged 1 commit intoMay 25, 2026
Conversation
opendkim.c: dkim_nametable_first/next expect const char **; declare entry_name as const char * to match. dkim-util.c: use sizeof path (not MAXPATHLEN) and explicit %.*s widths so the compiler can verify the tmpfile path fits in the buffer. opendkim-genzone.c: tmpbuf enlarged from BUFRSZ to LARGEBUFRSZ; selector and domain can each be up to BUFRSZ bytes so the old buffer was too small. opendkim.c: use explicit %.*s widths in reportaddr formatting and identity construction to bound output within the destination buffers; bound the username in the "no such user" error message similarly. Closes trusteddomainproject#359
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #359.
Changes
-Wincompatible-pointer-types(opendkim.c):dkim_nametable_first/dkim_nametable_nextexpectconst char **forthe name output parameter. Declare
entry_nameasconst char *tomatch. Fixes all four instances at once.
-Wformat-truncation:libopendkim/dkim-util.c: Usesizeof path(notMAXPATHLEN) asthe snprintf size, and add explicit
%.*swidths on the directoryand job-ID components so the compiler can verify the result fits.
opendkim/opendkim-genzone.c:tmpbufenlarged fromBUFRSZ+1(1025 bytes) to
LARGEBUFRSZ+1(8193 bytes). Selector and domaincan each be up to
BUFRSZbytes, so the old buffer was genuinelytoo small for pathological inputs.
opendkim/opendkim.c: Use%.*swith explicit widths in thereportaddrformatting (uid/hostname and name/hostname variants),the
"no such user"error message, and the@domainidentityconstruction to make output bounds explicit to the compiler.