fix(filepath): fixes of potential file inclusion via variable (#322)

Signed-off-by: nisarg1499 <nisshah1499@gmail.com>
This commit is contained in:
Nisarg Shah 2021-05-04 20:46:16 +05:30 committed by GitHub
parent a8376796b7
commit 0ebab22224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -62,7 +62,7 @@ func Get() string {
}
path := filepath.Join(os.Getenv("GOPATH") + versionFile)
vBytes, err := ioutil.ReadFile(path)
vBytes, err := ioutil.ReadFile(filepath.Clean(path))
if err != nil {
klog.Errorf("failed to get version: %s", err.Error())
return ""
@ -81,7 +81,7 @@ func GetBuildMeta() string {
}
path := filepath.Join(os.Getenv("GOPATH") + buildMetaFile)
vBytes, err := ioutil.ReadFile(path)
vBytes, err := ioutil.ReadFile(filepath.Clean(path))
if err != nil {
klog.Errorf("failed to get build version: %s", err.Error())
return ""