OpenDKIM icon indicating copy to clipboard operation
OpenDKIM copied to clipboard

patch to dkim.c:6092:49

Open hdatma opened this issue 5 years ago • 2 comments

dkim.c:6092:49: warning: size argument in 'strlcpy' call appears to be size 
of the source; expected the size of the destination [-Wstrlcpy-strlcat-size]
        strlcpy((char *) dkim->dkim_zdecode, z, strlen(z));
                                                ~~~~~~~^~

Proposed patch:

-       strlcpy((char *) dkim->dkim_zdecode, z, strlen(z));
+       strlcpy((char *) dkim->dkim_zdecode, z, strlen(dkim->dkim_zdecode));

hdatma avatar Jul 09 '20 09:07 hdatma

Hello Rupert,

I'm working on the new release. I'll review this along with the other issue as I go along.

-M

martinbogo avatar Jul 13 '20 15:07 martinbogo

I think the original code is right, howewer unusual. In the proposed patch, sizeof() should be instead of strlen() on a freshly allocated memory area.

rkojedzinszky avatar Dec 07 '23 20:12 rkojedzinszky