Module Name: src Committed By: martin Date: Tue Dec 18 18:36:22 UTC 2018
Modified Files: src/usr.bin/telnet [netbsd-7-1]: telnet.c utilities.c Log Message: Pull up following revision(s) (requested by maya in ticket #1665): usr.bin/telnet/utilities.c: revision 1.24 usr.bin/telnet/telnet.c: revision 1.37 switch sprintf to snprintf in places. Reported by hacker fantastic, thanks! ok xtos. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.36.28.1 src/usr.bin/telnet/telnet.c cvs rdiff -u -r1.23 -r1.23.28.1 src/usr.bin/telnet/utilities.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/telnet/telnet.c diff -u src/usr.bin/telnet/telnet.c:1.36 src/usr.bin/telnet/telnet.c:1.36.28.1 --- src/usr.bin/telnet/telnet.c:1.36 Tue Jan 10 13:49:32 2012 +++ src/usr.bin/telnet/telnet.c Tue Dec 18 18:36:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: telnet.c,v 1.36 2012/01/10 13:49:32 christos Exp $ */ +/* $NetBSD: telnet.c,v 1.36.28.1 2018/12/18 18:36:22 martin Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95"; #else -__RCSID("$NetBSD: telnet.c,v 1.36 2012/01/10 13:49:32 christos Exp $"); +__RCSID("$NetBSD: telnet.c,v 1.36.28.1 2018/12/18 18:36:22 martin Exp $"); #endif #endif /* not lint */ @@ -856,8 +856,8 @@ suboption(void) name = gettermname(); len = strlen(name) + 4 + 2; if (len < NETROOM()) { - sprintf((char *)temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, - TELQUAL_IS, name, IAC, SE); + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c", IAC, SB, + TELOPT_TTYPE, TELQUAL_IS, name, IAC, SE); ring_supply_data(&netoring, temp, len); printsub('>', &temp[2], len-2); } else { @@ -878,8 +878,8 @@ suboption(void) TerminalSpeeds(&isp, &osp); - sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, - TELQUAL_IS, osp, isp, IAC, SE); + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%ld,%ld%c%c", IAC, SB, + TELOPT_TSPEED, TELQUAL_IS, osp, isp, IAC, SE); len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ if (len < NETROOM()) { @@ -983,8 +983,8 @@ suboption(void) send_wont(TELOPT_XDISPLOC, 1); break; } - sprintf((char *)temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_XDISPLOC, - TELQUAL_IS, dp, IAC, SE); + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c", IAC, SB, + TELOPT_XDISPLOC, TELQUAL_IS, dp, IAC, SE); len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ if (len < NETROOM()) { Index: src/usr.bin/telnet/utilities.c diff -u src/usr.bin/telnet/utilities.c:1.23 src/usr.bin/telnet/utilities.c:1.23.28.1 --- src/usr.bin/telnet/utilities.c:1.23 Mon Jan 9 16:08:55 2012 +++ src/usr.bin/telnet/utilities.c Tue Dec 18 18:36:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: utilities.c,v 1.23 2012/01/09 16:08:55 christos Exp $ */ +/* $NetBSD: utilities.c,v 1.23.28.1 2018/12/18 18:36:22 martin Exp $ */ /* * Copyright (c) 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.3 (Berkeley) 5/30/95"; #else -__RCSID("$NetBSD: utilities.c,v 1.23 2012/01/09 16:08:55 christos Exp $"); +__RCSID("$NetBSD: utilities.c,v 1.23.28.1 2018/12/18 18:36:22 martin Exp $"); #endif #endif /* not lint */ @@ -633,7 +633,7 @@ printsub( } { char tbuf[64]; - sprintf(tbuf, "%s%s%s%s%s", + snprintf(tbuf, sizeof(tbuf), "%s%s%s%s%s", pointer[2]&MODE_EDIT ? "|EDIT" : "", pointer[2]&MODE_TRAPSIG ? "|TRAPSIG" : "", pointer[2]&MODE_SOFT_TAB ? "|SOFT_TAB" : "",