diff options
-rw-r--r-- | apps/filetree.c | 7 | ||||
-rw-r--r-- | apps/tree.c | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 64283b274b..79ea1eb687 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -436,9 +436,14 @@ int ft_enter(struct tree_context* c) | |||
436 | char buf[MAX_PATH]; | 436 | char buf[MAX_PATH]; |
437 | struct entry* file = tree_get_entry_at(c, c->selected_item); | 437 | struct entry* file = tree_get_entry_at(c, c->selected_item); |
438 | int file_attr = file->attr; | 438 | int file_attr = file->attr; |
439 | int len; | ||
439 | 440 | ||
440 | if (c->currdir[1]) | 441 | if (c->currdir[1]) |
441 | snprintf(buf,sizeof(buf),"%s/%s",c->currdir, file->name); | 442 | { |
443 | len = snprintf(buf,sizeof(buf),"%s/%s",c->currdir, file->name); | ||
444 | if ((unsigned) len > sizeof(buf)) | ||
445 | splash(HZ, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); | ||
446 | } | ||
442 | else | 447 | else |
443 | snprintf(buf,sizeof(buf),"/%s",file->name); | 448 | snprintf(buf,sizeof(buf),"/%s",file->name); |
444 | 449 | ||
diff --git a/apps/tree.c b/apps/tree.c index e03a494a54..6b496919b0 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -608,6 +608,7 @@ static int dirbrowse(void) | |||
608 | { | 608 | { |
609 | int numentries=0; | 609 | int numentries=0; |
610 | char buf[MAX_PATH]; | 610 | char buf[MAX_PATH]; |
611 | int len; | ||
611 | int button; | 612 | int button; |
612 | #ifdef HAVE_LCD_BITMAP | 613 | #ifdef HAVE_LCD_BITMAP |
613 | int oldbutton; | 614 | int oldbutton; |
@@ -800,8 +801,13 @@ static int dirbrowse(void) | |||
800 | attr = entry->attr; | 801 | attr = entry->attr; |
801 | 802 | ||
802 | if (currdir[1]) /* Not in / */ | 803 | if (currdir[1]) /* Not in / */ |
803 | snprintf(buf, sizeof buf, "%s/%s", | 804 | { |
805 | len = snprintf(buf, sizeof buf, "%s/%s", | ||
804 | currdir, entry->name); | 806 | currdir, entry->name); |
807 | |||
808 | if ((unsigned) len > sizeof(buf)) | ||
809 | splash(HZ, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); | ||
810 | } | ||
805 | else /* In / */ | 811 | else /* In / */ |
806 | snprintf(buf, sizeof buf, "/%s", entry->name); | 812 | snprintf(buf, sizeof buf, "/%s", entry->name); |
807 | } | 813 | } |