regex-quote: fix buffer access out of bounds