Skip to content

Fix compiler warnings (-Wincompatible-pointer-types, -Wformat-truncation) - #360

Merged
thegushi merged 1 commit into
trusteddomainproject:developfrom
thegushi:issue-359-compiler-warnings
May 25, 2026
Merged

Fix compiler warnings (-Wincompatible-pointer-types, -Wformat-truncation)#360
thegushi merged 1 commit into
trusteddomainproject:developfrom
thegushi:issue-359-compiler-warnings

Conversation

@thegushi

Copy link
Copy Markdown
Collaborator

Fixes #359.

Changes

-Wincompatible-pointer-types (opendkim.c):
dkim_nametable_first/dkim_nametable_next expect const char ** for
the name output parameter. Declare entry_name as const char * to
match. Fixes all four instances at once.

-Wformat-truncation:

  • libopendkim/dkim-util.c: Use sizeof path (not MAXPATHLEN) as
    the snprintf size, and add explicit %.*s widths on the directory
    and job-ID components so the compiler can verify the result fits.

  • opendkim/opendkim-genzone.c: tmpbuf enlarged from BUFRSZ+1
    (1025 bytes) to LARGEBUFRSZ+1 (8193 bytes). Selector and domain
    can each be up to BUFRSZ bytes, so the old buffer was genuinely
    too small for pathological inputs.

  • opendkim/opendkim.c: Use %.*s with explicit widths in the
    reportaddr formatting (uid/hostname and name/hostname variants),
    the "no such user" error message, and the @domain identity
    construction to make output bounds explicit to the compiler.

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
@thegushi
thegushi merged commit 29bfcd2 into trusteddomainproject:develop May 25, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant