Subject: bin/3718: typo in last commit of rcp; `name' is used uninitialized
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/07/1997 15:17:57
>Number:         3718
>Category:       bin
>Synopsis:       typo in last commit of rcp; `name' is used uninitialized and an error check condition is wrong.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun  6 23:20:01 1997
>Originator:     enami tsugutomo
>Release:        NetBSD-current 1997 Jun 05
System: NetBSD 1.2E NetBSD 1.2E (LIBRETTO) #154: Thu May 22 10:15:29 JST 1997 i386

	In last commit of rcp, there is a typo; in function toremote(),
	newly introduced auto variable `name' is used without initialized.
	Actually, pwd->pw_name should be used instead.

	And it checks whether return value from strdup is not NULL, and
	if it is not NULL, calls err().  It's wrong.

	Read diff of rcp.c 1.13 against 1.12.

	Here is my fix.

Index: rcp.c
RCS file: /a/cvsroot/NetBSD/src/bin/rcp/rcp.c,v
retrieving revision
diff -u -r1.1.1.3 rcp.c
--- rcp.c	1997/06/07 01:50:09
+++ rcp.c	1997/06/07 06:13:47
@@ -302,7 +302,7 @@
 					err(1, NULL);
 				(void)snprintf(bp, len, "%s -t %s", cmd, targ);
 				host = thost;
-				if ((name = strdup(name)) != NULL)
+				if ((name = strdup(pwd->pw_name)) == NULL)
 					err(1, NULL);
 #ifdef KERBEROS
 				if (use_kerberos)