1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-02 08:42:48 +00:00
freebsd/contrib/telnet
Dimitry Andric c794d18822 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
2023-12-21 23:45:52 +01:00
..
arpa telnet: remove 3rd clause from Berkeley copyrights 2019-08-15 13:27:57 +00:00
libtelnet telnet: remove locally added __FBSDID 2023-11-27 16:47:37 +00:00
telnet Fix snprintf truncation in telnet 2023-12-21 23:45:52 +01:00