chiark / gitweb /
It's a good idea to validate presets received from the environment.
authorSimon Tatham <anakin@pobox.com>
Wed, 18 May 2005 17:25:30 +0000 (17:25 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 18 May 2005 17:25:30 +0000 (17:25 +0000)
[originally from svn r5805]

midend.c

index 192d7e5e9c22d3caf22b0b8a1a042cd2b3e5d873..6e0a3625072b4fad05e00118bea91ae8cf5ce5dc 100644 (file)
--- a/midend.c
+++ b/midend.c
@@ -585,6 +585,12 @@ int midend_num_presets(midend_data *me)
                 preset = me->ourgame->default_params();
                 me->ourgame->decode_params(preset, val);
 
+               if (me->ourgame->validate_params(preset)) {
+                   /* Drop this one from the list. */
+                   me->ourgame->free_params(preset);
+                   continue;
+               }
+
                 if (me->presetsize <= me->npresets) {
                     me->presetsize = me->npresets + 10;
                     me->presets = sresize(me->presets, me->presetsize,