fix file_get_memory() boundary checking