Skip to content

Conversation

@Jeff-A-Martin
Copy link
Contributor

Replace calls to NlaBuffer::new with NlaBuffer::new_checked. This ensures that the parsing of individual NLAs is guaranteed to have a valid NlaBuffer (i.e. sufficient bytes to attempt parsing). Without this check, the parsing logic of several attributes would panic if provided with an NlaBuffer that was too short (e.g. length of 1).

One such example is the parsing of LinkVfPort, which would have panicked when calling buf.value() on line 61 of
src/link/sriov/vf_port.rs.

Replace calls to `NlaBuffer::new` with `NlaBuffer::new_checked`. This
ensures that the parsing of individual NLAs is guaranteed to have a
valid NlaBuffer (i.e. sufficient bytes to attempt parsing). Without this
check, the parsing logic of several attributes would panic if provided
with an NlaBuffer that was too short (e.g. length of 1).

One such example is the parsing of `LinkVfPort`, which would have
panicked when calling `buf.value()` on line 61 of
src/link/sriov/vf_port.rs.
bherrera pushed a commit to misttech/mist-os that referenced this pull request Jul 30, 2024
This patch imports the following pull requests from GitHub:
* rust-netlink/netlink-packet-route#128
* rust-netlink/netlink-packet-route#129

Fixed: b/353602659
Fixed: b/353775606
Change-Id: Ib209dbdaf09fb84f11b6ab9d2775a1284bbf360f
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1084502
Reviewed-by: Jeff Martin <martinjeffrey@google.com>
Fuchsia-Auto-Submit: Brian Bosak <bbosak@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
bherrera pushed a commit to misttech/integration that referenced this pull request Jul 30, 2024
This patch imports the following pull requests from GitHub:
* rust-netlink/netlink-packet-route#128
* rust-netlink/netlink-packet-route#129

Original-Fixed: b/353602659
Original-Fixed: b/353775606
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1084502
Original-Revision: 941d1385fc31291d5d1bdc6b50642c1fb7b70cf8
GitOrigin-RevId: 1c1169cc8a0f29231a9fc0664feda770eacf49a3
Change-Id: Ie70f1c3cbe5c60ac190d7251db11765cf9c87559
@cathay4t cathay4t enabled auto-merge (rebase) August 12, 2024 12:02
@cathay4t cathay4t merged commit fceb9c2 into rust-netlink:main Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants