Safeguard a bit in fill_pathname_abbrev*.

This commit is contained in:
Themaister 2013-12-24 23:36:47 +01:00
parent 0ba6bd8094
commit 5f1c3b48b3
1 changed files with 3 additions and 1 deletions

View File

@ -791,6 +791,8 @@ void fill_pathname_abbreviate_special(char *out_path, const char *in_path, size_
fill_pathname_application_path(application_dir, sizeof(application_dir));
path_basedir(application_dir);
// application_dir could be zero-string. Safeguard against this.
// Keep application dir in front of home, moving app dir to a new location inside
// home would break otherwise.
const char *candidates[3] = { application_dir, home, NULL };
@ -798,7 +800,7 @@ void fill_pathname_abbreviate_special(char *out_path, const char *in_path, size_
for (i = 0; candidates[i]; i++)
{
if (strstr(in_path, candidates[i]) == in_path)
if (*candidates[i] && strstr(in_path, candidates[i]) == in_path)
{
size_t src_size = strlcpy(out_path, notations[i], size);
rarch_assert(src_size < size);