forked from len0rd/rockbox
[coverity] tree.c set_current_file_ex explicitly check strrchr output
the math
size_t endpos = filename - path;
if (filename && endpos < MAX_PATH - 1)
should handle it just fine coverity doesn't think so
Change-Id: Ifa0494e56b40c8ab0081ebc771024a45cb24eb76
This commit is contained in:
parent
cc67f420f2
commit
5c7fbe8f1b
1 changed files with 2 additions and 2 deletions
|
|
@ -621,7 +621,7 @@ static void set_current_file_ex(const char *path, const char *filename)
|
|||
/* gets the directory's name and put it into tc.currdir */
|
||||
filename = strrchr(path+1,'/');
|
||||
size_t endpos = filename - path;
|
||||
if (endpos < MAX_PATH - 1)
|
||||
if (filename && endpos < MAX_PATH - 1)
|
||||
{
|
||||
strmemccpy(tc.currdir, path, endpos + 1);
|
||||
filename++;
|
||||
|
|
@ -1039,7 +1039,7 @@ int rockbox_browse(struct browse_context *browse)
|
|||
{
|
||||
tc.is_browsing = (browse != NULL);
|
||||
int ret_val = 0;
|
||||
int dirfilter = browse->dirfilter;
|
||||
int dirfilter = tc.is_browsing ? browse->dirfilter : SHOW_ALL;
|
||||
|
||||
if (backup_count >= NUM_TC_BACKUP)
|
||||
return GO_TO_PREVIOUS;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue