-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
border: check ifCurr before dereferencing it #1986
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sgmonroy)
go/border/rpkt/path.go, line 137 at r1 (raw file):
// instance from the current packet. func (rp *RtrPkt) mkInfoPathOffsets() scmp.Info { if curr, err := rp.IFCurr(); curr == nil || err != nil {
I think perhaps that the rest of the InfoPathOffset could still be created, with the IfID field as 0.
var ifid uint16
if curr, err := rp.IFCurr(); curr != nil && err =!= nil {
ifid = uint16(curr)
}
...
IfID ifid, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sgmonroy)
go/border/rpkt/path.go, line 137 at r1 (raw file):
Previously, kormat (Stephen Shirley) wrote…
I think perhaps that the rest of the InfoPathOffset could still be created, with the IfID field as 0.
var ifid uint16 if curr, err := rp.IFCurr(); curr != nil && err =!= nil { ifid = uint16(curr) } ... IfID ifid, ...
But that can be a bit misleading, you don't know if the ifCurr is pointing to a ifid with 0 value or you fail to get the current ifid
7d4adc0
to
2d4edbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @kormat)
go/border/rpkt/path.go, line 137 at r1 (raw file):
Previously, sgmonroy (Sergio Gonzalez Monroy) wrote…
But that can be a bit misleading, you don't know if the ifCurr is pointing to a ifid with 0 value or you fail to get the current ifid
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
There might be situations where ifCurr has not been set or cannot be calculated because, ie. malformed headers. Currently the border router panics in those situations when trying to create SCMP path offsets information. Safe check that ifCurr is set before use.
2d4edbf
to
51397ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved
There might be situations where ifCurr has not been set or cannot be
calculated because, ie. malformed headers.
Currently the border router panics in those situations when trying to
create SCMP path offsets information.
Safe check that ifCurr is set before use.
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)