Fix incorrect index use. nerr was being used for warning buffer check.

Wrong buffer size was being checked.