Fix AIOOBE when building syntax error message

Patch by Benjamin Lerer; reviewed by Tyler Hobbs for CASSANDRA-8455