Update unmarshalNBytes to return nil
when len
of value is zero
#7088
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.
Summary
References #7087
Where a JSON object with
null
as a value generated a EUI filled with zeros instead of it beingnil
.Changes
nil
instead of a slice withn
zero value elementsTesting
A bit complicated to validate the changes introduced by this PR besides running the current unit and e2e tests.
Reason being that the method is used in a lot of the API definitions, making it hard to manually test it.
Regressions
This is a extremely small PR but quite big in terms of impact, this method is used in unmarshalling any EUI field in the API, so if one of the routes doesn't handle a
nil
value in the field instead of a slice filled with empty values then it will generate an error.Fortunately most places where we process any EUI field we use
MustEUI64
followed byOrZero
and places without theOrZero
there is a explicit check for the field value beforehand.But it is used in many places and it is possible that something was missed, making it so that its worth paying extra attention to the deployment of this version.
Notes for Reviewers
Mostly what is written on the
Regressions
section.Checklist
README.md
for the chosen target branch.CHANGELOG.md
.CONTRIBUTING.md
, there are no fixup commits left.