Add UTF-8-support to strings(1), add t-flag and refactor code
Previously, the string-length was limited to BUFSIZ, which is an obvious deficiency. Now the buffer only needs to be as long as the user specifies the minimal string length. I added UTF-8-support, because that's how POSIX wants it and there are cases where you need this. It doesn't add ELF-barf compared to the previous implementation. The t-flag is also pretty important for POSIX-compliance, so I added it. The only trouble previously was the a-flag, but given that POSIX leaves undefined what the a-flag actually does, we set it as default and don't care about parsing ELF-headers, which has already turned out to be a security issue in GNU coreutils[0]. [0]: http://lcamtuf.blogspot.ro/2014/10/psa-dont-run-strings-on-untrusted-files.html
This commit is contained in:
Reference in New Issue
Block a user