]> git.puffer.fish Git - mirror/frr.git/commit
isisd: fix rcap tlv double-free crash
authorLouis Scalbert <louis.scalbert@6wind.com>
Thu, 12 Sep 2024 07:31:49 +0000 (09:31 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 17 Sep 2024 12:35:18 +0000 (12:35 +0000)
commit06e5366187bfd174f116c4d65890475d022e0b65
tree6fdf01158e0554e288ac345cccb6b261adb6fee8
parent212e152f57ced2420b5420ce6091898e43458e0d
isisd: fix rcap tlv double-free crash

A double-free crash happens when a subTLV of the "Router Capability"
TLV is not readable and a previous "Router Capability" TLV was read.

rcap was supposed to be freed later by isis_free_tlvs() ->
free_tlv_router_cap(). In 78774bbcd5 ("isisd: add isis flex-algo lsp
advertisement"), this was not the case because rcap was not saved to
tlvs->router_cap when the function returned early because of a subTLV
length issue.

Always set tlvs->router_cap to free the memory.

Note that this patch has the consequence that in case of subTLV error,
the previously read "Router Capability" subTLVs are kept in memory.

Fixes: 49efc80d34 ("isisd: Ensure rcap is freed in error case")
Fixes: 78774bbcd5 ("isisd: add isis flex-algo lsp advertisement")
Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit d61758140d33972c10ecbb72d0a3e528049dd8d6)
isisd/isis_tlvs.c