diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2020-11-01 22:46:29 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2020-11-09 12:35:07 +0900 |
commit | c297c0b222445df27e8e0642cbddf91be9ca8eb4 (patch) | |
tree | 7a7180eded11e28daf3c666b69d83b8ba34061e6 /pkg/server/grpc_server.go | |
parent | 46b15a7512c655683218ae867b2d42b99a73985e (diff) |
server: handle bogus addpath argument
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'pkg/server/grpc_server.go')
-rw-r--r-- | pkg/server/grpc_server.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go index 25c8495e..3a7121f7 100644 --- a/pkg/server/grpc_server.go +++ b/pkg/server/grpc_server.go @@ -310,6 +310,9 @@ func api2Path(resource api.TableType, path *api.Path, isWithdraw bool) (*table.P case *bgp.PathAttributeNextHop: nexthop = a.Value.String() case *bgp.PathAttributeMpReachNLRI: + if len(a.Value) == 0 { + return nil, fmt.Errorf("invalid mp reach attribute") + } nlri = a.Value[0] nexthop = a.Nexthop.String() default: |