mirror of
https://github.com/opencontainers/runc.git
synced 2025-04-18 19:44:09 +03:00
Fix runc crushes when parsing invalid JSON
Signed-off-by: Andrey Tsygunka <dreamsider@mail.ru>
This commit is contained in:
parent
537645fd52
commit
97ea1255ed
4
spec.go
4
spec.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
@ -126,6 +127,9 @@ func loadSpec(cPath string) (spec *specs.Spec, err error) {
|
||||
if err = json.NewDecoder(cf).Decode(&spec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if spec == nil {
|
||||
return nil, errors.New("config cannot be null")
|
||||
}
|
||||
return spec, validateProcessSpec(spec.Process)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user