[PATCH] avoid segfault in check_byte_count()