Check for null pointer before passing to realpath()

SVN revision: 34285
This commit is contained in:
Eric Schuele 2008-04-17 02:04:02 +00:00
parent 6dd6b76c0a
commit c48d02e391
1 changed files with 5 additions and 0 deletions

View File

@ -459,6 +459,11 @@ ecore_file_realpath(const char *file)
{
char buf[PATH_MAX];
/*
* Some implementations of realpath do not conform to the SUS.
* And as a result we must prevent a null arg from being passed.
*/
if (!file) return strdup("");
if (!realpath(file, buf)) return strdup("");
return strdup(buf);