mirror of https://github.com/JustKato/FreePad.git
* Fixed Security flaw ( Thanks @SleepingProcess )
This commit is contained in:
parent
22657cc111
commit
97102b98b3
|
@ -34,7 +34,7 @@ func getViewsFilePath() (string, error) {
|
||||||
// Check if the file exists
|
// Check if the file exists
|
||||||
if _, err := os.Stat(filePath); errors.Is(err, os.ErrNotExist) {
|
if _, err := os.Stat(filePath); errors.Is(err, os.ErrNotExist) {
|
||||||
// Create the file
|
// Create the file
|
||||||
err := os.WriteFile(filePath, []byte(""), 0777)
|
err := os.WriteFile(filePath, []byte(""), 0640)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ``, err
|
return ``, err
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ func SavePostViewsCache() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.OpenFile(viewsFilePath, os.O_WRONLY|os.O_CREATE, 0777)
|
f, err := os.OpenFile(viewsFilePath, os.O_WRONLY|os.O_CREATE, 0640)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ func getStorageDirectory() string {
|
||||||
// Check if the base storage path exists
|
// Check if the base storage path exists
|
||||||
if _, err := os.Stat(baseStoragePath); os.IsNotExist(err) {
|
if _, err := os.Stat(baseStoragePath); os.IsNotExist(err) {
|
||||||
// Looks like the base storage path was NOT set, create the dir
|
// Looks like the base storage path was NOT set, create the dir
|
||||||
err = os.Mkdir(baseStoragePath, 0777)
|
err = os.Mkdir(baseStoragePath, 0640)
|
||||||
// Check for errors
|
// Check for errors
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// No way this sends an error unless it goes horribly wrong.
|
// No way this sends an error unless it goes horribly wrong.
|
||||||
|
|
Loading…
Reference in New Issue