File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
"strings"
24
24
"syscall"
25
25
26
+ "github.com/containerd/containerd/identifiers"
26
27
"github.com/containerd/containerd/log"
27
28
"github.com/containerd/containerd/namespaces"
28
29
"github.com/containerd/containerd/plugin"
@@ -79,8 +80,7 @@ func (s *local) CreateVM(requestCtx context.Context, req *proto.CreateVMRequest)
79
80
var err error
80
81
81
82
id := req .GetVMID ()
82
- if id == "" {
83
- err = errors .New ("invalid VM ID" )
83
+ if err := identifiers .Validate (id ); err != nil {
84
84
s .logger .WithError (err ).Error ()
85
85
return nil , err
86
86
}
@@ -184,6 +184,10 @@ func (s *local) CreateVM(requestCtx context.Context, req *proto.CreateVMRequest)
184
184
}
185
185
186
186
func (s * local ) shimFirecrackerClient (requestCtx context.Context , vmID string ) (* fcclient.Client , error ) {
187
+ if err := identifiers .Validate (vmID ); err != nil {
188
+ return nil , errors .Wrap (err , "invalid id" )
189
+ }
190
+
187
191
socketAddr , err := fcShim .FCControlSocketAddress (requestCtx , vmID )
188
192
if err != nil {
189
193
err = errors .Wrap (err , "failed to get shim's fccontrol socket address" )
You can’t perform that action at this time.
0 commit comments