Bus Error with OpenSSH 3.7.1p2 on Solaris 8, SPARC 64-bit, YASSP

Darren Tucker dtucker at zip.com.au
Tue Sep 30 09:08:44 EST 2003


Thomas Baden wrote:
> 
> I had a problem much like the one that Matthias Koeppe
> experienced.  I would only get the BUS error when
> running in a YASSP-modified system, though.  The
> binary worked fine on a non-YASSP host.
> 
> I applied his change to use a long for the mask, and
> it works now.

I must admit I missed Matthias' original post.  The problem as I
understand it is that mode_t can be a (32bit) uint, which messes up the
(64bit) long format in sscanf in some 64bit configurations.

Matthias' original patch is attached, and I don't see a cleaner way to do
it except maybe

mode_t mask;
if (sscanf(var, "%5lo", &(mode_t)mask) == 1)

I don't even know if that will fix it.  I can't test it.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
-------------- next part --------------
Index: session.c
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/session.c,v
retrieving revision 1.255
diff -u -p -r1.255 session.c
--- session.c	22 Sep 2003 11:04:23 -0000	1.255
+++ session.c	29 Sep 2003 22:27:39 -0000
@@ -916,6 +916,7 @@ read_etc_default_login(char ***env, u_in
 	char **tmpenv = NULL, *var;
 	u_int i, tmpenvsize = 0;
 	mode_t mask;
+	unsigned long long_mask;
 
 	/*
 	 * We don't want to copy the whole file to the child's environment,
@@ -934,9 +935,11 @@ read_etc_default_login(char ***env, u_in
 	if (var != NULL)
 		child_set_env(env, envsize, "PATH", var);
 	
-	if ((var = child_get_env(tmpenv, "UMASK")) != NULL)
-		if (sscanf(var, "%5lo", &mask) == 1)
+	if ((var = child_get_env(tmpenv, "UMASK")) != NULL) {
+		if (sscanf(var, "%5lo", &long_mask) == 1)
+			mask = (mode_t)long_mask;
 			umask(mask);
+	}
 	
 	for (i = 0; tmpenv[i] != NULL; i++)
 		xfree(tmpenv[i]);


More information about the openssh-unix-dev mailing list