We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc9eb91 commit 292cf7cCopy full SHA for 292cf7c
eth/api.go
@@ -168,6 +168,11 @@ func NewPrivateAdminAPI(eth *Ethereum) *PrivateAdminAPI {
168
169
// ExportChain exports the current blockchain into a local file.
170
func (api *PrivateAdminAPI) ExportChain(file string) (bool, error) {
171
+ if _, err := os.Stat(file); err == nil {
172
+ // File already exists. Allowing overwrite could be a DoS vecotor,
173
+ // since the 'file' may point to arbitrary paths on the drive
174
+ return false, errors.New("location would overwrite an existing file")
175
+ }
176
// Make sure we can create the file to export into
177
out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm)
178
if err != nil {
0 commit comments