Fix BZ 18036 buffer overflow (read past end of buffer) in internal_fnmatch