1
0
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:
Andrey Tsygunka 2023-02-07 10:29:23 +03:00 committed by Andrey Tsygunka
parent 537645fd52
commit 97ea1255ed

View File

@ -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)
}