Fix a bug where a message header ending right on the stdio boundary