Skip to content

Conversation

@SpadeMomo
Copy link

This commit fix several issues in isis_tlvs.c including potential memory leak, unsigned integer underflow, and RFC violations.

  1. In function unpack_item_ext_subtlv_asla, add XFREE for alsa in multiple error branches.
  2. In function unpack_item_ext_subtlv_asla, add a check before subtracting subsubtlv_len from readable, because some case branches do not have checks against subsubtlv_len.
  3. In function unpack_item_ext_subtlv_asla and unpack_item_ext_subtlvs, add a check to skip remaining bytes if subtlv_len or subsubtlv_len is not divisible by 4. This check is to make sure that the buffer sync with sum.
  4. In function unpack_tlv_router_cap, free the previous rcap->fads[fad->fad.algorithm] if the slot is already allocated to prevent memory leak.
  5. In function unpack_subsubtlv_srv6_sid_structure, add a check that four sizes' sum must be less than or equal to 128, as RFC stated.

This commit fix several issues in isis_tlvs.c including potential memory leak,
unsigned integer underflow, and RFC violations.

1. In function `unpack_item_ext_subtlv_asla`, add `XFREE` for alsa in
multiple error branches.
2. In function `unpack_item_ext_subtlv_asla`, add a check before
subtracting `subsubtlv_len` from `readable`, because some case branches
do not have checks against `subsubtlv_len`.
3. In function `unpack_item_ext_subtlv_asla` and `unpack_item_ext_subtlvs`,
add a check to skip remaining bytes if `subtlv_len` or `subsubtlv_len`
is not divisible by 4. This check is to make sure that the buffer sync
with `sum`.
4. In function `unpack_tlv_router_cap`, free the previous
`rcap->fads[fad->fad.algorithm]` if the slot is already allocated to prevent
memory leak.
5. In function `unpack_subsubtlv_srv6_sid_structure`, add a check
that four sizes' sum must be less than or equal to 128, as RFC stated.

Signed-off-by: spademomo <realdingzhen@proton.me>
@donaldsharp
Copy link
Member

while you are in there fix the verify source issue pointed out as well. All of this looks pretty reasonable otherwise

Signed-off-by: spademomo <realdingzhen@proton.me>
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants