embryo: force the insertion of a '/' in the path to be sure that file path make sense.

This commit is contained in:
Cedric BAIL 2014-01-24 08:17:53 +09:00
parent 0078769f13
commit 5593964ead
1 changed files with 1 additions and 3 deletions

View File

@ -146,10 +146,8 @@ plungefile(char *name, int try_currentpath, int try_includepaths)
{
char path[PATH_MAX];
strncpy(path, ptr, sizeof path);
snprintf(path, sizeof (path), "%s/%s", ptr, name);
path[sizeof path - 1] = '\0'; /* force '\0' termination */
strncat(path, name, sizeof(path) - strlen(path) - 1);
path[sizeof path - 1] = '\0';
result = plungequalifiedfile(path);
} /* while */
} /* if */