- djm@cvs.openbsd.org 2005/06/17 02:44:33
     [auth-rsa.c auth.c auth1.c auth2-chall.c auth2-gss.c authfd.c authfile.c]
     [bufaux.c canohost.c channels.c cipher.c clientloop.c dns.c gss-serv.c]
     [kex.c kex.h key.c mac.c match.c misc.c packet.c packet.h scp.c]
     [servconf.c session.c session.h sftp-client.c sftp-server.c sftp.c]
     [ssh-keyscan.c ssh-rsa.c sshconnect.c sshconnect1.c sshconnect2.c sshd.c]
     make this -Wsign-compare clean; ok avsm@ markus@
     NB. auth1.c changes not committed yet (conflicts with uncommitted sync)
     NB2. more work may be needed to make portable Wsign-compare clean
diff --git a/misc.c b/misc.c
index fc094f8..c5ca0ce 100644
--- a/misc.c
+++ b/misc.c
@@ -24,7 +24,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.31 2005/06/06 11:20:36 djm Exp $");
+RCSID("$OpenBSD: misc.c,v 1.32 2005/06/17 02:44:32 djm Exp $");
 
 #include "misc.h"
 #include "log.h"
@@ -386,7 +386,7 @@
 	const char *path;
 	char user[128], ret[MAXPATHLEN];
 	struct passwd *pw;
-	int len;
+	u_int len, slash;
 
 	if (*filename != '~')
 		return (xstrdup(filename));
@@ -394,10 +394,11 @@
 
 	path = strchr(filename, '/');
 	if (path != NULL && path > filename) {		/* ~user/path */
-		if (path - filename > sizeof(user) - 1)
+		slash = path - filename;
+		if (slash > sizeof(user) - 1)
 			fatal("tilde_expand_filename: ~username too long");
-		memcpy(user, filename, path - filename);
-		user[path - filename] = '\0';
+		memcpy(user, filename, slash);
+		user[slash] = '\0';
 		if ((pw = getpwnam(user)) == NULL)
 			fatal("tilde_expand_filename: No such user %s", user);
 	} else if ((pw = getpwuid(uid)) == NULL)	/* ~/path */
@@ -435,7 +436,7 @@
 		const char *key;
 		const char *repl;
 	} keys[EXPAND_MAX_KEYS];
-	int num_keys, i, j;
+	u_int num_keys, i, j;
 	char buf[4096];
 	va_list ap;