diff --git a/cheevos.c b/cheevos.c
index 2dcf019221..aa8b3f2dfa 100644
--- a/cheevos.c
+++ b/cheevos.c
@@ -2335,7 +2335,12 @@ static size_t cheevos_eval_md5(
          size += num_read;
          
          if (max_size != 0)
+         {
             max_size -= num_read;
+            
+            if (max_size == 0)
+               break;
+         }
       }
 
       filestream_close(file);