summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/twiddle.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-08-16 11:37:10 -0400
committerFranklin Wei <git@fwei.tk>2017-08-16 11:40:42 -0400
commitf31a400bac0b72e773e32d2a17ac839145dded2b (patch)
treedc812d909b41fe51870b568cc5e4cb2315b95c7c /apps/plugins/puzzles/src/twiddle.c
parentc78ff7f6153d2a787bfd8cb3410dff8db74b2789 (diff)
downloadrockbox-f31a400bac0b72e773e32d2a17ac839145dded2b.zip
rockbox-f31a400bac0b72e773e32d2a17ac839145dded2b.tar.gz
rockbox-f31a400bac0b72e773e32d2a17ac839145dded2b.tar.bz2
rockbox-f31a400bac0b72e773e32d2a17ac839145dded2b.tar.xz
puzzles: add more parameter validation checks
Fixes some annoying crashes. Change-Id: If3c293bd90e301c3e697d1e5fcb1b0aa2ea320fb
Diffstat (limited to 'apps/plugins/puzzles/src/twiddle.c')
-rw-r--r--apps/plugins/puzzles/src/twiddle.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/twiddle.c b/apps/plugins/puzzles/src/twiddle.c
index 6e05f4d..224c041 100644
--- a/apps/plugins/puzzles/src/twiddle.c
+++ b/apps/plugins/puzzles/src/twiddle.c
@@ -217,6 +217,8 @@ static char *validate_params(const game_params *params, int full)
return "Width must be at least the rotating block size";
if (params->h < params->n)
return "Height must be at least the rotating block size";
+ if (params->movetarget < 0)
+ return "Number of shuffling moves may not be negative";
return NULL;
}