]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: avoid reading beyond end of color indicator
authorJim Meyering <meyering@redhat.com>
Fri, 30 Sep 2011 18:13:01 +0000 (20:13 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 30 Sep 2011 20:03:47 +0000 (22:03 +0200)
commit4f38e9f24971762540da9d5457dfa9e5e03d53ee
treed32acd375a120adfedef0573167a4bcaa8c337b7
parentbec8920923fc3505606b92e4cf732afa714c63c5
ls: avoid reading beyond end of color indicator

At first this looked like a buffer overrun, since there was no test
to ensure that the buffer length was 6.  However, since the LS_COLORS
string is NUL-terminated and since settings within it are separated by
":" there was neither the risk of reading beyond end of buffer nor risk
of a false-positive match.
* src/ls.c (print_color_indicator): Use color_symlink_as_referent
rather than manually comparing against "target" again.
* src/system.h (STRNCMP_LIT): Correct description in comment.
src/ls.c
src/system.h