vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Petr Lautrbach 8f8619
diff -U0 openssh-6.4p1/ChangeLog.bad-env-var openssh-6.4p1/ChangeLog
Petr Lautrbach 8f8619
--- openssh-6.4p1/ChangeLog.bad-env-var	2014-03-19 21:37:36.270509907 +0100
Petr Lautrbach 8f8619
+++ openssh-6.4p1/ChangeLog	2014-03-19 21:37:36.276509878 +0100
Petr Lautrbach 8f8619
@@ -0,0 +1,7 @@
Petr Lautrbach 8f8619
+20140304
Petr Lautrbach 8f8619
+ - OpenBSD CVS Sync
Petr Lautrbach 8f8619
+   - djm@cvs.openbsd.org 2014/03/03 22:22:30
Petr Lautrbach 8f8619
+     [session.c]
Petr Lautrbach 8f8619
+     ignore enviornment variables with embedded '=' or '\0' characters;
Petr Lautrbach 8f8619
+     spotted by Jann Horn; ok deraadt@
Petr Lautrbach 8f8619
+
Petr Lautrbach 8f8619
diff -up openssh-6.4p1/session.c.bad-env-var openssh-6.4p1/session.c
Petr Lautrbach 8f8619
--- openssh-6.4p1/session.c.bad-env-var	2014-03-19 21:37:36.233510090 +0100
Petr Lautrbach 8f8619
+++ openssh-6.4p1/session.c	2014-03-19 21:37:36.277509873 +0100
Petr Lautrbach 8f8619
@@ -990,6 +990,11 @@ child_set_env(char ***envp, u_int *envsi
Petr Lautrbach 8f8619
 	u_int envsize;
Petr Lautrbach 8f8619
 	u_int i, namelen;
Petr Lautrbach 8f8619
 
Petr Lautrbach 8f8619
+	if (strchr(name, '=') != NULL) {
Petr Lautrbach 8f8619
+		error("Invalid environment variable \"%.100s\"", name);
Petr Lautrbach 8f8619
+		return;
Petr Lautrbach 8f8619
+	}
Petr Lautrbach 8f8619
+
Petr Lautrbach 8f8619
 	/*
Petr Lautrbach 8f8619
 	 * If we're passed an uninitialized list, allocate a single null
Petr Lautrbach 8f8619
 	 * entry before continuing.
Petr Lautrbach 8f8619
@@ -2255,8 +2260,8 @@ session_env_req(Session *s)
Petr Lautrbach 8f8619
 	char *name, *val;
Petr Lautrbach 8f8619
 	u_int name_len, val_len, i;
Petr Lautrbach 8f8619
 
Petr Lautrbach 8f8619
-	name = packet_get_string(&name_len);
Petr Lautrbach 8f8619
-	val = packet_get_string(&val_len);
Petr Lautrbach 8f8619
+	name = packet_get_cstring(&name_len);
Petr Lautrbach 8f8619
+	val = packet_get_cstring(&val_len);
Petr Lautrbach 8f8619
 	packet_check_eom();
Petr Lautrbach 8f8619
 
Petr Lautrbach 8f8619
 	/* Don't set too many environment variables */