summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
authorOlivier Dugeon <olivier.dugeon@orange.com>2024-02-26 10:40:34 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2024-05-06 03:02:55 +0200
commit34ec60582880c7697981582f53eb8d7bd6e7f02b (patch)
tree29e0a965bd6fdbd87854b6cdbd19625922d91b64 /ospfd
parentb21e7b8fe8c4970f2f6f794cb78bcc93057af94f (diff)
ospfd: Solved crash in OSPF TE parsing
Iggy Frankovic discovered an ospfd crash when perfomring fuzzing of OSPF LSA packets. The crash occurs in ospf_te_parse_te() function when attemping to create corresponding egde from TE Link parameters. If there is no local address, an edge is created but without any attributes. During parsing, the function try to access to this attribute fields which has not been created causing an ospfd crash. The patch simply check if the te parser has found a valid local address. If not found, we stop the parser which avoid the crash. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> (cherry picked from commit a73e66d07329d721f26f3f336f7735de420b0183)
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_te.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 75f4e0c9f0..45eb205759 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -2276,6 +2276,10 @@ static int ospf_te_parse_te(struct ls_ted *ted, struct ospf_lsa *lsa)
}
/* Get corresponding Edge from Link State Data Base */
+ if (IPV4_NET0(attr.standard.local.s_addr) && !attr.standard.local_id) {
+ ote_debug(" |- Found no TE Link local address/ID. Abort!");
+ return -1;
+ }
edge = get_edge(ted, attr.adv, attr.standard.local);
old = edge->attributes;