Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.bin/telnet Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/be9f36228452
branches:  netbsd-7
changeset: 446778:be9f36228452
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 18 18:36:10 2018 +0000

description:
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.

diffstat:

 usr.bin/telnet/telnet.c    |  16 ++++++++--------
 usr.bin/telnet/utilities.c |   6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diffs (78 lines):

diff -r 2b30f522ff25 -r be9f36228452 usr.bin/telnet/telnet.c
--- a/usr.bin/telnet/telnet.c   Tue Dec 18 18:35:26 2018 +0000
+++ b/usr.bin/telnet/telnet.c   Tue Dec 18 18:36:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: telnet.c,v 1.36 2012/01/10 13:49:32 christos Exp $     */
+/*     $NetBSD: telnet.c,v 1.36.18.1 2018/12/18 18:36:10 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.18.1 2018/12/18 18:36:10 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -856,8 +856,8 @@
            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 @@
 
            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 @@
                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()) {
diff -r 2b30f522ff25 -r be9f36228452 usr.bin/telnet/utilities.c
--- a/usr.bin/telnet/utilities.c        Tue Dec 18 18:35:26 2018 +0000
+++ b/usr.bin/telnet/utilities.c        Tue Dec 18 18:36:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: utilities.c,v 1.23 2012/01/09 16:08:55 christos Exp $  */
+/*     $NetBSD: utilities.c,v 1.23.18.1 2018/12/18 18:36:10 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.18.1 2018/12/18 18:36:10 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -633,7 +633,7 @@
                }
                {
                    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" : "",



Home | Main Index | Thread Index | Old Index