From dan@fio.cz  Sun Jan 24 16:02:33 1999
Received: from fio.cz (prahaa11.vol.cz [195.250.153.12])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA09659
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Jan 1999 16:02:28 -0800 (PST)
          (envelope-from dan@fio.cz)
Received: (from root@localhost)
	by fio.cz (8.9.2/8.9.0) id AAA00908;
	Mon, 25 Jan 1999 00:42:07 +0100 (CET)
Message-Id: <199901242342.AAA00908@fio.cz>
Date: Mon, 25 Jan 1999 00:42:07 +0100 (CET)
From: dan@obluda.cz
Reply-To: dan@obluda.cz
To: FreeBSD-gnats-submit@freebsd.org
Cc: brian@awfulhak.org
Subject: [PATCH] PPP ``set title'' command versus command line processing error
X-Send-Pr-Version: 3.2

>Number:         9669
>Category:       bin
>Synopsis:       ppp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 24 17:20:03 PST 1999
>Closed-Date:    Mon Jan 25 02:23:21 PST 1999
>Last-Modified:  Mon Jan 25 02:23:45 PST 1999
>Originator:     Dan Lukes
>Release:        FreeBSD 2.2.8-RELEASE i386
>Organization:
Obludarium
>Environment:

	User process PPP
	$Id: main.c,v 1.22.2.50 1998/11/26 07:14:43 jkh Exp $

>Description:

	If "set [proc]title ..." command used inside "default" section of
configuration file then destroy argv[1] item - it has been set to NULL.
Later in processing, it (destroyed) argument is used as section name. It
caused SYGSEGV abend at line 311/systems.c (function ReadSystem). 

	Independent problem - the SetProcTitle function in command.c 
- should be or shouldn't be rewritten using ``setproctitle(3)'' function ... ?

>How-To-Repeat:

	Put "set title <any text>" command into section default of ppp.conf.
	Run ppp with no "option" arguments but one or more "section name"
arguments.

>Fix:
--- main.c.ORIG Thu Nov 26 08:14:43 1998
+++ main.c      Mon Jan 25 00:34:07 1999
@@ -349,6 +349,14 @@

   sig_signal(SIGUSR2, BringDownServer);

+/* In case the `set title ...'' used in default section, so argv[1] is destroyed now */
+  if ( label == 1 && argc > 1 ) {
+    /* In case we use LABEL or `set enddisc label'' */
+    bundle_SetLabel(bundle, argc == 2 ? bundle->argv1 : argv[argc - 1]);
+    system_Select(bundle, bundle->argv1, CONFFILE, prompt, NULL);
+    label++;
+  }
+
   for (arg = label; arg < argc; arg++) {
     /* In case we use LABEL or `set enddisc label'' */
     bundle_SetLabel(bundle, argv[argc - 1]);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Mon Jan 25 02:23:21 PST 1999 
State-Changed-Why:  
Fixed in -current -stable and RELENG_2_2 
>Unformatted:
