relpTcpConnect: message could be truncated
andreasstieger opened this issue · 2 comments
andreasstieger commented
In tcp.c both errmsg
and errStr
are defined as char[1024]
, but errStr
is printed with the error connecting: '%s'
format, which may cause the message to be truncated.
tcp.c: In function 'relpTcpConnect':
tcp.c:3069:57: warning: '%s' directive output may be truncated writing up to 1023 bytes into a region of size 1005 [-Wformat-truncation=]
snprintf(errmsg, sizeof(errmsg), "error connecting: '%s'", errStr);
^~ ~~~~~~
Is this intentional?
rgerhards commented
Well, actually kind of. We do not care if it is truncated and it really doesn't hurt. Nevertheless, to get rid of the compiler warning we will probably reduce one buffer size.
rgerhards commented
This is actually already fixed, I think with 1.3.0. Looks like it was forgotten to be closed.