Tru64 UNIX SIA in 2.5.2p1 is hosed (still)

Damien Miller djm at mindrot.org
Thu Mar 22 09:56:24 EST 2001


On Wed, 21 Mar 2001, Gert Doering wrote:


> -> so what we do should be fine.
>
> >  			cp = xmalloc(22 + strlen(s->tty) +
> >  			    2 * strlen(pw->pw_name));
> >  			i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c",
> > -			    pw->pw_name, 0, pw->pw_name, 0, s->tty, 0,0);
> > +			    pw->pw_name, 0, pw->pw_name, 0,
> > +			    s->ttyfd == -1 ? "" : s->tty, 0,0);
>
> What I'm not sure here: what will strlen(s->tty) be if s->ttyfd is -1?

Does this work OK (relative to last diff):

Index: session.c
===================================================================
RCS file: /var/cvs/openssh/session.c,v
retrieving revision 1.94
diff -u -r1.94 session.c
--- session.c	2001/03/21 05:13:03	1.94
+++ session.c	2001/03/21 22:55:09
@@ -1134,11 +1134,12 @@
 			 * other stuff is stored - a few applications
 			 * actually use this and die if it's not set
 			 */
+			if (s->ttyfd == -1)
+				s->tty[0] = '\0';
 			cp = xmalloc(22 + strlen(s->tty) +
 			    2 * strlen(pw->pw_name));
 			i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c",
-			    pw->pw_name, 0, pw->pw_name, 0,
-			    s->ttyfd == -1 ? "" : s->tty, 0,0);
+			    pw->pw_name, 0, pw->pw_name, 0, s->tty, 0, 0);
 			if (usrinfo(SETUINFO, cp, i) == -1)
 				fatal("Couldn't set usrinfo: %s",
 				    strerror(errno));


-- 
| Damien Miller <djm at mindrot.org> \ ``E-mail attachments are the poor man's
| http://www.mindrot.org          /   distributed filesystem'' - Dan Geer






More information about the openssh-unix-dev mailing list