Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix heap overflow with UTF-8 meta characters (#206)
If a meta character has its high bit set, then the %x format would interpret the character as a signed integer on most systems, i.e. on systems which have signed chars instead of unsigned chars. Cast *s to guarantee that only two hex digits are printed, otherwise the allocated space would be not enough. How to reproduce (-fsanitize=address, HAVE_POPEN setup, e.g. Linux): LESSMETACHARS=$(echo -e '\xff') less -f /dev/null (now type "-T x" and press enter to trigger lglob function call)
- Loading branch information