mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
fix(filepath): fixes of potential file inclusion via variable (#322)
Signed-off-by: nisarg1499 <nisshah1499@gmail.com>
This commit is contained in:
parent
a8376796b7
commit
0ebab22224
2 changed files with 4 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
mnt "github.com/openebs/lib-csi/pkg/mount"
|
||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||
|
|
@ -297,7 +298,7 @@ func MountBlock(vol *apis.ZFSVolume, mountinfo *MountInfo) error {
|
|||
}
|
||||
|
||||
func makeFile(pathname string) error {
|
||||
f, err := os.OpenFile(pathname, os.O_CREATE, os.FileMode(0644))
|
||||
f, err := os.OpenFile(filepath.Clean(pathname), os.O_CREATE, os.FileMode(0644))
|
||||
defer f.Close()
|
||||
if err != nil {
|
||||
if !os.IsExist(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue