]> Cypherpunks repositories - gostls13.git/commit
archive/tar: ensure input fits in octal field
authorJoe Tsai <joetsai@digital-static.net>
Wed, 9 Aug 2017 18:08:55 +0000 (11:08 -0700)
committerJoe Tsai <thebrokentoaster@gmail.com>
Fri, 11 Aug 2017 03:25:17 +0000 (03:25 +0000)
commit310ba828289f8c4924bc0f319b72e151f5f079f7
treeff099d40279506af11cc718700a4b9b85e9f788b
parent019d8a07e102bd0047a70d026986d7c02781e26f
archive/tar: ensure input fits in octal field

The prior logic would over-write the NUL-terminator if the octal value
was long enough. In order to prevent this, we add a fitsInOctal function
that does the proper check.

The relevant USTAR specification about NUL-terminator is:
<<<
Each numeric field is terminated by one or more <space> or NUL characters.
>>>

Change-Id: I6fbc6e8fe71168727eea201925d0fe08d43116ac
Reviewed-on: https://go-review.googlesource.com/54432
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/archive/tar/strconv.go
src/archive/tar/strconv_test.go
src/archive/tar/writer.go