buffer add length check