From 42ba117952fcb4e486aa7a0e27add800a8649e31 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 23 Jul 2021 10:31:56 -0400 Subject: tree.c use strlcpy to avoid buffer ovfl Change-Id: I6ac4ec6306c2101b11bc0495edd7bbe2717acf9c --- apps/tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/tree.c b/apps/tree.c index 88ccff5e37..1f7102dbb9 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -372,7 +372,7 @@ static int update_dir(void) { if (ft_load(&tc, NULL) < 0) return -1; - strcpy(lastdir, tc.currdir); + strlcpy(lastdir, tc.currdir, MAX_PATH); changed = true; } } @@ -568,7 +568,7 @@ void set_current_file(const char *path) name = path+1; } - strcpy(lastfile, name); + strlcpy(lastfile, name, MAX_PATH); /* If we changed dir we must recalculate the dirlevel @@ -987,7 +987,7 @@ int rockbox_browse(struct browse_context *browse) if (dirfilter != SHOW_ID3DB) tc.dirfilter = &global_settings.dirfilter; tc.browse = browse; - strcpy(current, browse->root); + strlcpy(current, browse->root, MAX_PATH); set_current_file(current); if (browse->flags&BROWSE_RUNFILE) ret_val = ft_enter(&tc); -- cgit v1.2.3