diff options
Diffstat (limited to 'net/dccp/options.c')
-rw-r--r-- | net/dccp/options.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c index dc7c158a2f4b..0809b63cb055 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
@@ -81,11 +81,11 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
81 | /* Check if this isn't a single byte option */ | 81 | /* Check if this isn't a single byte option */ |
82 | if (opt > DCCPO_MAX_RESERVED) { | 82 | if (opt > DCCPO_MAX_RESERVED) { |
83 | if (opt_ptr == opt_end) | 83 | if (opt_ptr == opt_end) |
84 | goto out_invalid_option; | 84 | goto out_nonsensical_length; |
85 | 85 | ||
86 | len = *opt_ptr++; | 86 | len = *opt_ptr++; |
87 | if (len < 3) | 87 | if (len < 2) |
88 | goto out_invalid_option; | 88 | goto out_nonsensical_length; |
89 | /* | 89 | /* |
90 | * Remove the type and len fields, leaving | 90 | * Remove the type and len fields, leaving |
91 | * just the value size | 91 | * just the value size |
@@ -95,7 +95,7 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
95 | opt_ptr += len; | 95 | opt_ptr += len; |
96 | 96 | ||
97 | if (opt_ptr > opt_end) | 97 | if (opt_ptr > opt_end) |
98 | goto out_invalid_option; | 98 | goto out_nonsensical_length; |
99 | } | 99 | } |
100 | 100 | ||
101 | /* | 101 | /* |
@@ -283,12 +283,17 @@ ignore_option: | |||
283 | if (mandatory) | 283 | if (mandatory) |
284 | goto out_invalid_option; | 284 | goto out_invalid_option; |
285 | 285 | ||
286 | out_nonsensical_length: | ||
287 | /* RFC 4340, 5.8: ignore option and all remaining option space */ | ||
286 | return 0; | 288 | return 0; |
287 | 289 | ||
288 | out_invalid_option: | 290 | out_invalid_option: |
289 | DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT); | 291 | DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT); |
290 | DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR; | 292 | DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR; |
291 | DCCP_WARN("DCCP(%p): invalid option %d, len=%d", sk, opt, len); | 293 | DCCP_WARN("DCCP(%p): invalid option %d, len=%d", sk, opt, len); |
294 | DCCP_SKB_CB(skb)->dccpd_reset_data[0] = opt; | ||
295 | DCCP_SKB_CB(skb)->dccpd_reset_data[1] = len > 0 ? value[0] : 0; | ||
296 | DCCP_SKB_CB(skb)->dccpd_reset_data[2] = len > 1 ? value[1] : 0; | ||
292 | return -1; | 297 | return -1; |
293 | } | 298 | } |
294 | 299 | ||