Fix truncation warnings in tree.c, filetree.c
Change-Id: Ic5ae1e5f904a3da4bba07cdef7f4bb003dc091b2
This commit is contained in:
parent
7bec71368b
commit
5e5ddce270
2 changed files with 13 additions and 2 deletions
|
@ -436,9 +436,14 @@ int ft_enter(struct tree_context* c)
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
struct entry* file = tree_get_entry_at(c, c->selected_item);
|
struct entry* file = tree_get_entry_at(c, c->selected_item);
|
||||||
int file_attr = file->attr;
|
int file_attr = file->attr;
|
||||||
|
int len;
|
||||||
|
|
||||||
if (c->currdir[1])
|
if (c->currdir[1])
|
||||||
snprintf(buf,sizeof(buf),"%s/%s",c->currdir, file->name);
|
{
|
||||||
|
len = snprintf(buf,sizeof(buf),"%s/%s",c->currdir, file->name);
|
||||||
|
if ((unsigned) len > sizeof(buf))
|
||||||
|
splash(HZ, ID2P(LANG_PLAYLIST_ACCESS_ERROR));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
snprintf(buf,sizeof(buf),"/%s",file->name);
|
snprintf(buf,sizeof(buf),"/%s",file->name);
|
||||||
|
|
||||||
|
|
|
@ -608,6 +608,7 @@ static int dirbrowse(void)
|
||||||
{
|
{
|
||||||
int numentries=0;
|
int numentries=0;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
int len;
|
||||||
int button;
|
int button;
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int oldbutton;
|
int oldbutton;
|
||||||
|
@ -800,8 +801,13 @@ static int dirbrowse(void)
|
||||||
attr = entry->attr;
|
attr = entry->attr;
|
||||||
|
|
||||||
if (currdir[1]) /* Not in / */
|
if (currdir[1]) /* Not in / */
|
||||||
snprintf(buf, sizeof buf, "%s/%s",
|
{
|
||||||
|
len = snprintf(buf, sizeof buf, "%s/%s",
|
||||||
currdir, entry->name);
|
currdir, entry->name);
|
||||||
|
|
||||||
|
if ((unsigned) len > sizeof(buf))
|
||||||
|
splash(HZ, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
|
||||||
|
}
|
||||||
else /* In / */
|
else /* In / */
|
||||||
snprintf(buf, sizeof buf, "/%s", entry->name);
|
snprintf(buf, sizeof buf, "/%s", entry->name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue