"const char ESC_CHARS[] = {'\r','\n'};"

This doesn't have a null terminator, which could definitely cause problems.  The string "\r\n" automatically null terminates.

Josh