Fix potential buffer overrun for EBCDIC.