Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/99ac49b87090
branches:  netbsd-7-0
changeset: 446781:99ac49b87090
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 18 18:37:26 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 44dc6918111e -r 99ac49b87090 usr.bin/telnet/telnet.c
--- a/usr.bin/telnet/telnet.c   Fri Dec 14 12:08:43 2018 +0000
+++ b/usr.bin/telnet/telnet.c   Tue Dec 18 18:37:26 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.20.1 2018/12/18 18:37:26 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.20.1 2018/12/18 18:37:26 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 44dc6918111e -r 99ac49b87090 usr.bin/telnet/utilities.c
--- a/usr.bin/telnet/utilities.c        Fri Dec 14 12:08:43 2018 +0000
+++ b/usr.bin/telnet/utilities.c        Tue Dec 18 18:37:26 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.20.1 2018/12/18 18:37:26 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.20.1 2018/12/18 18:37:26 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