safety fixes: incorrect type requirement in buffer_to_block signature, and using appropriate safe size type for read size parameter