Skip to content

Commit

Permalink
Correct max length of quoted path and use const
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkw31 committed Nov 29, 2024
1 parent 99de117 commit e597080
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion walk/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
)

const userOnlyPerm = 0700
const maxQuotedPathLength = 4096*4 + 2

// WriteError is an error received when trying to write strings to disk.
type WriteError struct {
Expand Down Expand Up @@ -115,7 +116,7 @@ func NewFiles(outDir string, n int) (*Files, error) {
//
// It will terminate the walk if writes to our output files fail.
func (f *Files) WritePaths() PathCallback {
var quoted [10240]byte
var quoted [maxQuotedPathLength]byte

return func(entry *Dirent) error {
return f.writePath(append(strconv.AppendQuote(quoted[:0], entry.Path.String()), '\n'))
Expand Down

0 comments on commit e597080

Please sign in to comment.