isisd: Reject SRv6 Locator TLV with Loc-Size of zero - #21641
Conversation
RFC 9352 Section 7.1 requires Loc-Size to be in the range 1-128. A value of zero is invalid and must cause the entire TLV to be ignored. The existing check only rejects values greater than 128, allowing zero through and producing a zero-length prefix that can confuse downstream consumers. Fix this by extending the condition to also reject zero: if (rv->prefix.prefixlen == 0 || rv->prefix.prefixlen > IPV6_MAX_BITLEN) Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
|
@Mergifyio backport stable/10.6 stable/10.5 stable/10.4 stable/10.3 |
β Backports have been createdDetails
|
Greptile SummaryThis PR adds a missing zero-check to the Confidence Score: 5/5Safe to merge β minimal, targeted RFC 9352 compliance fix with no side effects. The change is a single-line addition of a zero-check that directly implements an explicit RFC requirement. The error path (goto out) correctly frees allocated memory and was already tested by the > IPV6_MAX_BITLEN branch. No new logic paths, no behavioral changes for valid input, and no ripple effects elsewhere in the codebase. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["unpack_item_srv6_locator()"] --> B["Read 7 mandatory bytes\n(metric, flags, algorithm, loc-size)"]
B --> C{"len < 7?"}
C -- yes --> OUT["goto out\n(free rv, return 1)"]
C -- no --> D["rv->prefix.prefixlen = stream_getc(s)"]
D --> E{"prefixlen == 0\nOR\nprefixlen > 128?"}
E -- yes --> OUT
E -- no --> F["Read prefix bytes\nApply mask"]
F --> G["Read sub-TLV length"]
G --> H{"subtlv_len > 0?"}
H -- yes --> I["Unpack sub-TLVs"]
H -- no --> J["append_item(), return 0"]
I --> J
Reviews (1): Last reviewed commit: "isisd: Reject SRv6 Locator TLV with Loc-..." | Re-trigger Greptile |
|
@Mergifyio backport stable/10.6 stable/10.5 stable/10.4 stable/10.3 stable/10.2 stable/10.1 stable/10.0 |
β No backport have been createdDetails
Git reported the following error:
Git reported the following error:
Git reported the following error:
Git reported the following error:
|
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
isisd: Reject SRv6 Locator TLV with Loc-Size of zero (backport #21641)
RFC 9352 Section 7.1 requires Loc-Size to be in the range 1-128. A value of zero is invalid and must cause the entire TLV to be ignored. The existing check only rejects values greater than 128, allowing zero through and producing a zero-length prefix that can confuse downstream consumers.
Fix this by extending the condition to also reject zero: