rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/openssh-6.6p1-memory-problems.patch

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