Searched hist:c794d188 (Results 1 – 1 of 1) sorted by relevance
/freebsd/contrib/telnet/telnet/ |
H A D | telnet.c | c794d188 Thu Dec 21 22:35:17 GMT 2023 Dimitry Andric <dim@FreeBSD.org> Fix snprintf truncation in telnet
Building telnet with clang 18 results in the following warning:
contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^
The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case.
Bump the buffer to 11 chars to avoid truncation.
MFC after: 3 days c794d188 Thu Dec 21 22:35:17 GMT 2023 Dimitry Andric <dim@FreeBSD.org> Fix snprintf truncation in telnet
Building telnet with clang 18 results in the following warning:
contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^
The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case.
Bump the buffer to 11 chars to avoid truncation.
MFC after: 3 days
|