StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
{
if(fd->current_position + size > fd->size){
- size = fd->size - fd->current_position;
+ if (fd->current_position > fd->size){
+ size = 0;
+ } else {
+ size = fd->size - fd->current_position;
+ }
fd->current_position = fd->size;
}
else