summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-07-25 19:28:25 +0200
committerWilliam Wilgus <me.theuser@yahoo.com>2018-07-25 19:33:52 +0200
commit5e5ddce270ce8fb87baff7ce898173fe2ae2fb6b (patch)
treea45e6b40c3f1fc2ef59bd416d5f6d54eca026a6a /apps
parent7bec71368b306657323d80585019bb7e2aa0888c (diff)
downloadrockbox-5e5ddce270ce8fb87baff7ce898173fe2ae2fb6b.tar.gz
rockbox-5e5ddce270ce8fb87baff7ce898173fe2ae2fb6b.zip
Fix truncation warnings in tree.c, filetree.c
Change-Id: Ic5ae1e5f904a3da4bba07cdef7f4bb003dc091b2
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c7
-rw-r--r--apps/tree.c8
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 }