From landonf@zadder.apple.com  Tue Nov 19 03:23:47 2002
Return-Path: <landonf@zadder.apple.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2597337B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 19 Nov 2002 03:23:47 -0800 (PST)
Received: from zadder.apple.com (A17-202-45-71.apple.com [17.202.45.71])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C11CD43E97
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 19 Nov 2002 03:23:46 -0800 (PST)
	(envelope-from landonf@zadder.apple.com)
Received: from zadder.apple.com (localhost [127.0.0.1])
	by zadder.apple.com (8.12.6/8.12.6) with ESMTP id gAJMIc9b066597;
	Tue, 19 Nov 2002 22:18:38 GMT
	(envelope-from landonf@zadder.apple.com)
Received: (from landonf@localhost)
	by zadder.apple.com (8.12.6/8.12.6/Submit) id gAJMIcZo066596;
	Tue, 19 Nov 2002 22:18:38 GMT
Message-Id: <200211192218.gAJMIcZo066596@zadder.apple.com>
Date: Tue, 19 Nov 2002 22:18:38 GMT
From: "Landon J. Fuller" <landonf@apple.com>
Reply-To: "Landon J. Fuller" <landonf@apple.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] telnet fails to check for strrchr failure when parsing source route specification
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45476
>Category:       bin
>Synopsis:       [PATCH] telnet fails to check for strrchr failure when parsing source route specification
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    eric
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 19 03:30:01 PST 2002
>Closed-Date:    Wed Nov 20 10:19:21 PST 2002
>Last-Modified:  Wed Nov 20 10:19:46 PST 2002
>Originator:     Landon J. Fuller
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Apple Computer, Inc.
>Environment:
System: FreeBSD zadder 5.0-CURRENT FreeBSD 5.0-CURRENT #5: Sat Nov 9 01:41:12 GMT 2002 root@zadder:/usr/obj/usr/src/sys/ZADDER i386
>Description:
	telnet fails to check for strrchr() returning NULL when parsing out a source route specification
>How-To-Repeat:
	landonf@zadder> telnet
	telnet> open !crash
	Segmentation fault (core dumped)

>Fix:

--- telnet.diff begins here ---
Index: commands.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/telnet/commands.c,v
retrieving revision 1.38
diff -u -r1.38 commands.c
--- commands.c	2002/10/02 00:29:34	1.38
+++ commands.c	2002/11/18 21:21:36
@@ -2026,8 +2026,12 @@
 #endif
 	    (hostname = strrchr(hostp, ':')) == NULL)
 	    hostname = strrchr(hostp, '@');
-	hostname++;
-	srcroute = 1;
+	if (hostname == NULL) {
+	    hostname = hostp;
+	} else {
+	    hostname++;
+	    srcroute = 1;
+	}
     } else
         hostname = hostp;
     if (!portp) {
--- telnet.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: eric 
State-Changed-When: Wed Nov 20 10:18:55 PST 2002 
State-Changed-Why:  
committed 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45476 
Responsible-Changed-From-To: freebsd-bugs->eric 
Responsible-Changed-By: eric 
Responsible-Changed-When: Wed Nov 20 10:19:27 PST 2002 
Responsible-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=45476 
>Unformatted:
