Skip to contentSkip to conversation

2.0-2.5 bug in ip_options_compile

PATCH In review Jeff DeFouw 3 participants 3 messages Sep 13, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.0-2.5 bug in ip_options_compile

While reading about IP options, I found the IPOPT_END padding (cleaning) in ip_options_compile (net/ipv4/ip_options.c) was not incrementing a pointer. There should be an optptr++ in the for end-of-block statement to go along with the l--, otherwise it's just comparing the same byte for each l. Patch is against 2.4.19. From the kernel source browser this bug is also in 2.5.31, 2.2.21, and 2.0.39.

net/ipv4/ip_options.c renamed from net/ipv4/ip_options.c.orig +1 -1
@@ -266,7 +266,7 @@
 	for (l = opt->optlen; l > 0; ) {
 		switch (*optptr) {
 		      case IPOPT_END:
-			for (optptr++, l--; l>0; l--) {
+			for (optptr++, l--; l>0; optptr++, l--) {
 				if (*optptr != IPOPT_END) {
 					*optptr = IPOPT_END;
 					opt->is_changed = 1;
Signature · 1 line
Jeff DeFouw <[email protected]>
#1 lore raw

From: Jeff DeFouw <[email protected]>
Date: Fri, 13 Sep 2002 17:08:38 -0500

While reading about IP options, I found the IPOPT_END padding (cleaning) in ip_options_compile (net/ipv4/ip_options.c) was not incrementing a pointer. There should be an optptr++ in the for end-of-block statement to go along with the l--, otherwise it's just comparing the same byte for each l. Patch is against 2.4.19. From the kernel source browser this bug is also in 2.5.31, 2.2.21, and 2.0.39.

Thanks a lot for spotting this, I will add this
to my 2.4.x and 2.5.x trees and merge upstream.

#2 lore raw
Quoted 10 lines · David S. Miller

From: Jeff DeFouw <[email protected]>
Date: Fri, 13 Sep 2002 17:08:38 -0500

While reading about IP options, I found the IPOPT_END padding (cleaning) in ip_options_compile (net/ipv4/ip_options.c) was not incrementing a pointer. There should be an optptr++ in the for end-of-block statement to go along with the l--, otherwise it's just comparing the same byte for each l. Patch is against 2.4.19. From the kernel source browser this bug is also in 2.5.31, 2.2.21, and 2.0.39.

Quoted 2 lines

Thanks a lot for spotting this, I will add this
to my 2.4.x and 2.5.x trees and merge upstream.

Thanks. Will be in 2.0.40-rc7.

Regards: David Weinehall

Signature · 3 lines
 /> David Weinehall <[email protected]> /> Northern lights wander      <\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\>  http://www.acc.umu.se/~tao/    </   Full colour fire           </