summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2020-06-27 20:24:31 -0400
committerFranklin Wei <franklin@rockbox.org>2020-06-27 20:28:46 -0400
commit7da8137bdb333d4f8424d098d90331e1fb83fb45 (patch)
treefe6bd0e5c535cafa61a0cf06740b02f9ce1cd6f0
parentc02a9c5ab3b0d2c4a6d9fb0e558fa5e8e9271770 (diff)
downloadrockbox-7da8137bdb333d4f8424d098d90331e1fb83fb45.tar.gz
rockbox-7da8137bdb333d4f8424d098d90331e1fb83fb45.zip
puzzles: fix crash when loading a corrupt save
I misread the documentation here, thinking that the pointer would be set to *point to* a null byte, not to a null pointer itself. [1] [1]: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/midend.html#identify-game Change-Id: I9b76bba9b1611dfd8e05d076a69f7554b5b74c53
-rw-r--r--apps/plugins/puzzles/rockbox.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index a10bf7dd5c..eabe739657 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -3201,9 +3201,8 @@ static bool load_game(void)
3201 char *game; 3201 char *game;
3202 const char *ret = identify_game(&game, read_wrapper, (void*)fd); 3202 const char *ret = identify_game(&game, read_wrapper, (void*)fd);
3203 3203
3204 if(!*game && ret) 3204 if(!game && ret)
3205 { 3205 {
3206 sfree(game);
3207 rb->splash(HZ, ret); 3206 rb->splash(HZ, ret);
3208 rb->close(fd); 3207 rb->close(fd);
3209 return false; 3208 return false;