T7964 - Fix edgecase with empty commands array.
#439
Merged
+15
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Summary
So, I made a mistake in this PR: https://github.com/vyos/vyos.vyos/pull/403/files#diff-55d967f7efb21cec719c5ad71ac942a7769acf87c6e2747720fde15f62fa1fadR376.
When the
commandsis empty, this will throw a "index out of bounds" error.Types of changes
Related Task(s)
Related PR(s)
https://github.com/vyos/vyos.vyos/pull/403/files#diff-55d967f7efb21cec719c5ad71ac942a7769acf87c6e2747720fde15f62fa1fadR376
Component(s) name
firewall(_global)
Proposed changes
Just a simple
len(commands) > 0check.How to test
Just like the test, create a group without anything in it (
set firewall group EMPTY), and run areplacedfirewall_globaltask.Test results
Failing test: https://github.com/RubenNL/vyos.vyos/actions/runs/18937208873
Succeeding test: https://github.com/RubenNL/vyos.vyos/actions/runs/18937491823
Tested against VyOS versions:
Checklist:
changelogs/fragmentsto describe the changes