Subject: bin/3718: typo in last commit of rcp; `name' is used uninitialized
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
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
>Last-Modified:
>Originator: enami tsugutomo
>Organization:
>Release: NetBSD-current 1997 Jun 05
>Environment:
System: NetBSD libretto.enami.ba2.so-net.or.jp 1.2E NetBSD 1.2E (LIBRETTO) #154: Thu May 22 10:15:29 JST 1997 enami@libretto.enami.ba2.so-net.or.jp:/a/kernel/compile/LIBRETTO i386
>Description:
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.
>How-To-Repeat:
Read diff of rcp.c 1.13 against 1.12.
>Fix:
Here is my fix.
Index: rcp.c
===================================================================
RCS file: /a/cvsroot/NetBSD/src/bin/rcp/rcp.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 rcp.c
--- rcp.c 1997/06/07 01:50:09 1.1.1.3
+++ 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)
>Audit-Trail:
>Unformatted: