diff options
author | Neale Ranns <nranns@cisco.com> | 2017-12-06 00:45:33 -0800 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-12-06 19:40:06 +0000 |
commit | f363ebd4e7cd60dada11daa0e61b64569a9e1cf6 (patch) | |
tree | f197d40542c46e7b4741d7d8fbfea3934c69ad72 /src/vnet/dpo/mpls_label_dpo.c | |
parent | 73e4f7965b7f6c0ff3c1217962f76ad586af6332 (diff) |
Label stack size exceeded fix
Change-Id: Ibe2041d83e9b5be16801dc316bd472ae4f6e8c31
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/dpo/mpls_label_dpo.c')
-rw-r--r-- | src/vnet/dpo/mpls_label_dpo.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c index c6e8dcc475c..fa5177ab9ea 100644 --- a/src/vnet/dpo/mpls_label_dpo.c +++ b/src/vnet/dpo/mpls_label_dpo.c @@ -16,6 +16,7 @@ #include <vnet/ip/ip.h> #include <vnet/dpo/mpls_label_dpo.h> #include <vnet/mpls/mpls.h> +#include <vnet/dpo/drop_dpo.h> /* * pool of all MPLS Label DPOs @@ -53,6 +54,17 @@ mpls_label_dpo_create (mpls_label_t *label_stack, u32 ii; mld = mpls_label_dpo_alloc(); + + if (MPLS_LABEL_DPO_MAX_N_LABELS < vec_len(label_stack)) + { + clib_warning("Label stack size exceeded"); + dpo_stack(DPO_MPLS_LABEL, + mld->mld_payload_proto, + &mld->mld_dpo, + drop_dpo_get(DPO_PROTO_MPLS)); + return (mpls_label_dpo_get_index(mld)); + } + mld->mld_n_labels = vec_len(label_stack); mld->mld_n_hdr_bytes = mld->mld_n_labels * sizeof(mld->mld_hdr[0]); mld->mld_payload_proto = payload_proto; |