vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jan F. Chadima 49d0cf
diff -up openssh-5.2p1/canohost.c.ip-opts openssh-5.2p1/canohost.c
Jan F. Chadima 49d0cf
--- openssh-5.2p1/canohost.c.ip-opts	2009-02-14 06:28:21.000000000 +0100
Jan F. Chadima 49d0cf
+++ openssh-5.2p1/canohost.c	2009-09-01 15:31:29.000000000 +0200
Jan F. Chadima 49d0cf
@@ -169,12 +169,27 @@ check_ip_options(int sock, char *ipaddr)
Jan F. Chadima 49d0cf
 	option_size = sizeof(options);
Jan F. Chadima 49d0cf
 	if (getsockopt(sock, ipproto, IP_OPTIONS, options,
Jan F. Chadima 49d0cf
 	    &option_size) >= 0 && option_size != 0) {
Jan F. Chadima 49d0cf
-		text[0] = '\0';
Jan F. Chadima 49d0cf
-		for (i = 0; i < option_size; i++)
Jan F. Chadima 49d0cf
-			snprintf(text + i*3, sizeof(text) - i*3,
Jan F. Chadima 49d0cf
-			    " %2.2x", options[i]);
Jan F. Chadima 49d0cf
-		fatal("Connection from %.100s with IP options:%.800s",
Jan F. Chadima 49d0cf
-		    ipaddr, text);
Jan F. Chadima 49d0cf
+		i = 0;
Jan F. Chadima 49d0cf
+		do {
Jan F. Chadima 49d0cf
+			switch (options[i]) {
Jan F. Chadima 49d0cf
+				case 0:
Jan F. Chadima 49d0cf
+				case 1:
Jan F. Chadima 49d0cf
+					++i;
Jan F. Chadima 49d0cf
+					break;
Jan F. Chadima 49d0cf
+				case 131:
Jan F. Chadima 49d0cf
+				case 137:
Jan F. Chadima 49d0cf
+				/* Fail, fatally, if we detect either loose or strict
Jan F. Chadima 49d0cf
+			 	 * source routing options. */
Jan F. Chadima 49d0cf
+					text[0] = '\0';
Jan F. Chadima 49d0cf
+					for (i = 0; i < option_size; i++)
Jan F. Chadima 49d0cf
+						snprintf(text + i*3, sizeof(text) - i*3,
Jan F. Chadima 49d0cf
+							" %2.2x", options[i]);
Jan F. Chadima 49d0cf
+					fatal("Connection from %.100s with IP options:%.800s",
Jan F. Chadima 49d0cf
+						ipaddr, text);
Jan F. Chadima 49d0cf
+				default:
Jan F. Chadima 49d0cf
+					i += options[i + 1];
Jan F. Chadima 49d0cf
+			}
Jan F. Chadima 49d0cf
+		} while (i < option_size);
Jan F. Chadima 49d0cf
 	}
Jan F. Chadima 49d0cf
 #endif /* IP_OPTIONS */
Jan F. Chadima 49d0cf
 }