Commit e3dc9c76 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Check number of arguments

parent 33d583bf
......@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"fmt"
"os"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/handler"
......@@ -19,6 +20,10 @@ func main() {
logger.Fatal("preparation failed", err)
}
if n := len(os.Args); n != 3 {
logger.Fatal("wrong number of arguments", fmt.Errorf("expected 2 arguments, got %v", os.Args))
}
var request pb.SSHReceivePackRequest
if err := json.Unmarshal([]byte(os.Args[2]), &request); err != nil {
logger.Fatal("unmarshaling request json failed", err)
......
......@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"fmt"
"os"
"gitlab.com/gitlab-org/gitlab-shell/go/internal/handler"
......@@ -19,6 +20,10 @@ func main() {
logger.Fatal("preparation failed", err)
}
if n := len(os.Args); n != 3 {
logger.Fatal("wrong number of arguments", fmt.Errorf("expected 2 arguments, got %v", os.Args))
}
var request pb.SSHUploadPackRequest
if err := json.Unmarshal([]byte(os.Args[2]), &request); err != nil {
logger.Fatal("unmarshaling request json failed", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment