diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-07-23 10:31:56 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2021-07-24 13:44:35 +0000 |
commit | 42ba117952fcb4e486aa7a0e27add800a8649e31 (patch) | |
tree | ce992379566e974793efda07d605deef7bf26beb /apps/tree.c | |
parent | 26fd90bb49a5191dc7f4c853e1ec8aa334b5a5c7 (diff) | |
download | rockbox-42ba117952fcb4e486aa7a0e27add800a8649e31.tar.gz rockbox-42ba117952fcb4e486aa7a0e27add800a8649e31.zip |
tree.c use strlcpy to avoid buffer ovfl
Change-Id: I6ac4ec6306c2101b11bc0495edd7bbe2717acf9c
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 6 |
1 files 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) | |||
372 | { | 372 | { |
373 | if (ft_load(&tc, NULL) < 0) | 373 | if (ft_load(&tc, NULL) < 0) |
374 | return -1; | 374 | return -1; |
375 | strcpy(lastdir, tc.currdir); | 375 | strlcpy(lastdir, tc.currdir, MAX_PATH); |
376 | changed = true; | 376 | changed = true; |
377 | } | 377 | } |
378 | } | 378 | } |
@@ -568,7 +568,7 @@ void set_current_file(const char *path) | |||
568 | name = path+1; | 568 | name = path+1; |
569 | } | 569 | } |
570 | 570 | ||
571 | strcpy(lastfile, name); | 571 | strlcpy(lastfile, name, MAX_PATH); |
572 | 572 | ||
573 | 573 | ||
574 | /* If we changed dir we must recalculate the dirlevel | 574 | /* If we changed dir we must recalculate the dirlevel |
@@ -987,7 +987,7 @@ int rockbox_browse(struct browse_context *browse) | |||
987 | if (dirfilter != SHOW_ID3DB) | 987 | if (dirfilter != SHOW_ID3DB) |
988 | tc.dirfilter = &global_settings.dirfilter; | 988 | tc.dirfilter = &global_settings.dirfilter; |
989 | tc.browse = browse; | 989 | tc.browse = browse; |
990 | strcpy(current, browse->root); | 990 | strlcpy(current, browse->root, MAX_PATH); |
991 | set_current_file(current); | 991 | set_current_file(current); |
992 | if (browse->flags&BROWSE_RUNFILE) | 992 | if (browse->flags&BROWSE_RUNFILE) |
993 | ret_val = ft_enter(&tc); | 993 | ret_val = ft_enter(&tc); |