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
withNlaBuffer::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 callingbuf.value()
on line 61 of src/link/sriov/vf_port.rs.