routerrpc: Check for nil IncomingCircuitKey
The grpc stream.Recv() will decode an ForwardHtlcInterceptResponse without an IncomingCircuit, which will leave that pointer nil, causing a nil pointer dereferece when components of in.IncomingCircuitKey are used in the resolveFromClient() function. This commit checks for the nil pointer and returns an error before the rest of the parsing.
This commit is contained in:
1 parent
f94500281f
commit
17f7b9f322
2 files changed
+8
No files matched your search
@@ -100,6 +100,11 @@ func (r *forwardInterceptor) onIntercept(
|
||||
func (r *forwardInterceptor) resolveFromClient(
|
||||
in *ForwardHtlcInterceptResponse) error {
|
||||
|
||||
if in.IncomingCircuitKey == nil {
|
||||
return status.Errorf(codes.InvalidArgument,
|
||||
"CircuitKey missing from ForwardHtlcInterceptResponse")
|
||||
}
|
||||
|
||||
log.Tracef("Resolving intercepted packet %v", in)
|
||||
|
||||
circuitKey := models.CircuitKey{
|
||||
|
||||
Reference in new issue
Block a user