From fa79991e93f52a42f53740d87880ed7af6efc6aa Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 23 Jan 2023 20:28:55 +0100 Subject: [PATCH] packages/hyprspace: HyprspaceRPC.Route: validate argument count --- packages/networking/hyprspace/rpc/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/networking/hyprspace/rpc/server.go b/packages/networking/hyprspace/rpc/server.go index edb3129..714b377 100644 --- a/packages/networking/hyprspace/rpc/server.go +++ b/packages/networking/hyprspace/rpc/server.go @@ -75,6 +75,9 @@ func (hsr *HyprspaceRPC) Route(args *RouteArgs, reply *RouteReply) error { Routes: routes, } case Relay: + if len(args.Args) != 2 { + return errors.New("expected exactly 2 arguments") + } var networks []net.IPNet if args.Args[0] == "all" { for _, r := range hsr.config.Routes { @@ -99,6 +102,9 @@ func (hsr *HyprspaceRPC) Route(args *RouteArgs, reply *RouteReply) error { p2p.AddReroute(n, p) } case Reset: + if len(args.Args) != 1 { + return errors.New("expected exactly 1 argument") + } var networks []net.IPNet if args.Args[0] == "all" { for _, r := range hsr.config.Routes {