rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
Blob Blame History Raw
diff --git a/servconf.c b/servconf.c
index ad5869b..0255ed3 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1910,6 +1910,8 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
 		dst->n = src->n; \
 } while (0)
 
+	u_int i;
+
 	M_CP_INTOPT(password_authentication);
 	M_CP_INTOPT(gss_authentication);
 	M_CP_INTOPT(rsa_authentication);
@@ -1947,8 +1949,10 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
 } while(0)
 #define M_CP_STRARRAYOPT(n, num_n) do {\
 	if (src->num_n != 0) { \
+		for (i = 0; i < dst->num_n; i++) \
+			free(dst->n[i]); \
 		for (dst->num_n = 0; dst->num_n < src->num_n; dst->num_n++) \
-			dst->n[dst->num_n] = xstrdup(src->n[dst->num_n]); \
+			dst->n[dst->num_n] = src->n[dst->num_n]; \
 	} \
 } while(0)
 
diff --git a/sshd.c b/sshd.c
index 7e43153..f2a08f6 100644
--- a/sshd.c
+++ b/sshd.c
@@ -2160,10 +2160,12 @@ main(int ac, char **av)
 	}
 #endif /* LIBWRAP */
 
+	char *addr = get_local_ipaddr(sock_in);
 	/* Log the connection. */
 	verbose("Connection from %s port %d on %s port %d",
 	    remote_ip, remote_port,
-	    get_local_ipaddr(sock_in), get_local_port());
+	    addr, get_local_port());
+	free(addr);
 
 	/*
 	 * We don't want to listen forever unless the other side