From 5e5ddce270ce8fb87baff7ce898173fe2ae2fb6b Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 25 Jul 2018 19:28:25 +0200 Subject: Fix truncation warnings in tree.c, filetree.c Change-Id: Ic5ae1e5f904a3da4bba07cdef7f4bb003dc091b2 --- apps/tree.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/tree.c') 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) { int numentries=0; char buf[MAX_PATH]; + int len; int button; #ifdef HAVE_LCD_BITMAP int oldbutton; @@ -800,8 +801,13 @@ static int dirbrowse(void) attr = entry->attr; if (currdir[1]) /* Not in / */ - snprintf(buf, sizeof buf, "%s/%s", + { + len = snprintf(buf, sizeof buf, "%s/%s", currdir, entry->name); + + if ((unsigned) len > sizeof(buf)) + splash(HZ, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + } else /* In / */ snprintf(buf, sizeof buf, "/%s", entry->name); } -- cgit v1.2.3