diff options
author | Toon Claes <toon@iotcl.com> | 2022-10-12 17:24:33 +0200 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2022-10-12 17:33:46 +0200 |
commit | 7dd5d8f39a3c31c8257c29a8cfa4ef2cf15d4a80 (patch) | |
tree | 95f8fa1512318b887697ef5914e3f91b77ee9b81 /plumbing/format/packfile/packfile_test.go | |
parent | 08cffa1efade914020497a73907763e8d3707a77 (diff) | |
download | go-git-7dd5d8f39a3c31c8257c29a8cfa4ef2cf15d4a80.tar.gz |
plumbing: gitattributes, Avoid index out of range
When a path is deeper than the single asterisk pattern the code would
crash with a "index out of range".
This change checks the length of the remaining pattern before it
references an element of that slice.
With a single trailing asterisk paths deeper than the pattern should not
get the attributes.
For example with the following `.gitattributes` file:
thirdparty/* linguist-vendored
This is how git handles it:
$ git check-attr --all thirdparty/README.md
thirdparty/README.md: diff: markdown
thirdparty/README.md: linguist-vendored: set
$ git check-attr --all thirdparty/package/README.md
thirdparty/package/README.md: diff: markdown
Diffstat (limited to 'plumbing/format/packfile/packfile_test.go')
0 files changed, 0 insertions, 0 deletions