vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Petr Lautrbach 94c6f8
diff --git a/canohost.c b/canohost.c
Petr Lautrbach 94c6f8
index a61a8c9..97ce58c 100644
Petr Lautrbach 94c6f8
--- a/canohost.c
Petr Lautrbach 94c6f8
+++ b/canohost.c
Petr Lautrbach 94c6f8
@@ -165,12 +165,29 @@ 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;
Petr Lautrbach 94c6f8
+				case 130:
Petr Lautrbach 94c6f8
+				case 133:
Petr Lautrbach 94c6f8
+				case 134:
Petr Lautrbach 94c6f8
+					i += options[i + 1];
Petr Lautrbach 94c6f8
+					break;
Petr Lautrbach 94c6f8
+				default:
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
+			}
Jan F. Chadima 49d0cf
+		} while (i < option_size);
Jan F. Chadima 49d0cf
 	}
Jan F. Chadima 49d0cf
 #endif /* IP_OPTIONS */
Jan F. Chadima 49d0cf
 }