Prevent tampering with PRNG parameters in save
[open-adventure.git] / saveresume.c
index cf1dd6c287115f7790fe92f0ac25a0542cd5dcee..c5d51816e3b664029fbf09c6eed7872811663798 100644 (file)
@@ -139,6 +139,12 @@ bool is_valid(struct game_t valgame)
         return false;
     }
 
+    /* Prevent RNG substitution. Why we are saving PRNG parameters? */
+
+    if (valgame.lcg_a != game.lcg_a || valgame.lcg_c != game.lcg_c || valgame.lcg_m != game.lcg_m) {
+        return false;
+    }
+
     /*  Bounds check for locations */
     if ( valgame.chloc < -1  || valgame.chloc > NLOCATIONS  ||
          valgame.chloc2 < -1  || valgame.chloc2 > NLOCATIONS  ||