summaryrefslogtreecommitdiff
path: root/apps/plugins/sokoban.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sokoban.c')
-rw-r--r--apps/plugins/sokoban.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 8672249bdc..bfd400b408 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -689,7 +689,8 @@ static bool redo(void)
689 689
690static void init_boards(void) 690static void init_boards(void)
691{ 691{
692 rb->strncpy(buffered_boards.filename, SOKOBAN_LEVELS_FILE, MAX_PATH); 692 rb->strlcpy(buffered_boards.filename, SOKOBAN_LEVELS_FILE,
693 sizeof(buffered_boards.filename));
693 694
694 current_info.level.index = 0; 695 current_info.level.index = 0;
695 current_info.player.row = 0; 696 current_info.player.row = 0;
@@ -1026,8 +1027,8 @@ static bool save(char *filename, bool solution)
1026 1027
1027 /* Create dir if it doesn't exist */ 1028 /* Create dir if it doesn't exist */
1028 if ((loc = rb->strrchr(filename, '/')) != NULL) { 1029 if ((loc = rb->strrchr(filename, '/')) != NULL) {
1029 rb->strncpy(dirname, filename, loc - filename); 1030 rb->strlcpy(dirname, filename, loc - filename + 1);
1030 dirname[loc - filename] = '\0'; 1031
1031 if(!(dir = rb->opendir(dirname))) 1032 if(!(dir = rb->opendir(dirname)))
1032 rb->mkdir(dirname); 1033 rb->mkdir(dirname);
1033 else 1034 else
@@ -1082,7 +1083,9 @@ static bool load(char *filename, bool silent)
1082 if (rb->strncmp(buf, "Sokoban", 7) != 0) { 1083 if (rb->strncmp(buf, "Sokoban", 7) != 0) {
1083 rb->close(fd); 1084 rb->close(fd);
1084 1085
1085 rb->strncpy(buffered_boards.filename, filename, MAX_PATH); 1086 rb->strlcpy(buffered_boards.filename, filename,
1087 sizeof(buffered_boards.filename));
1088
1086 if (!read_levels(true)) 1089 if (!read_levels(true))
1087 return false; 1090 return false;
1088 1091