Skip to content

Commit 840ec05

Browse files
callthingsoffgopherbot
authored andcommitted
archive/tar: narrow trim range for formatter'formatString
Trim s[:len(b)-1] rather than s[:len(b)], since s[len(b)-1] is '/'. Change-Id: I055da555810c112774549bd13d4faa8bfa0a60dc GitHub-Last-Rev: 4579775 GitHub-Pull-Request: #60729 Reviewed-on: https://go-review.googlesource.com/c/go/+/502376 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent d4b46b0 commit 840ec05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/archive/tar/strconv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (f *formatter) formatString(b []byte, s string) {
7373
// in the V7 path field as a directory even though the full path
7474
// recorded elsewhere (e.g., via PAX record) contains no trailing slash.
7575
if len(s) > len(b) && b[len(b)-1] == '/' {
76-
n := len(strings.TrimRight(s[:len(b)], "/"))
76+
n := len(strings.TrimRight(s[:len(b)-1], "/"))
7777
b[n] = 0 // Replace trailing slash with NUL terminator
7878
}
7979
}

0 commit comments

Comments
 (0)