Subject: bin/17766: mname in ftp's confirm() is not always initialized in ls() and mls()
To: None <gnats-bugs@gnats.netbsd.org>
From: None <steve.mcclellan@radisys.com>
List: netbsd-bugs
Date: 07/30/2002 09:19:21
>Number:         17766
>Category:       bin
>Synopsis:       mname in ftp's confirm() is not always initialized in ls() and mls()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 30 09:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Steve McClellan
>Release:        1.5.1
>Organization:
RadiSys
>Environment:
OS-9 for PPC/ARM4/ARM4BE/X86
>Description:
mname in ftp's confirm() is not always initialized in ls() and mls().

See fix below.
>How-To-Repeat:

ftp> dir foo rom
output to local-file: rom [anpqy?]? q
Error #103:004

>Fix:
ftp/cmds.c
Before calling confirm in ls() and mls() mname must be set. In ls(), I suggest (without my extra comments) :
	} else if ((strcmp(locfile, "-") != 0) && *locfile != '|') {
+++     mname = argv[0];
		if ((locfile = globulize(locfile)) == NULL ||

In mls() you need to move mname up:
	argv[argc - 1] = NULL;
+++	mname = argv[0];
	if (strcmp(dest, "-") && *dest != '|')
		if (((dest = globulize(dest)) == NULL) ||
		    !confirm("output to local-file:", dest)) {
			code = -1;
			return;
	}
	dolist = strcmp(argv[0], "mls");
---	/* mname = argv[0]; move up */
	mflag = 1;

>Release-Note:
>Audit-Trail:
>Unformatted: