CID-1294436: handle null file paths to switch_is_file_path correctly

This commit is contained in:
Michael Jerris 2015-04-23 10:52:25 -04:00
parent 91a6fc82c0
commit c7709a191b
1 changed files with 6 additions and 3 deletions

View File

@ -1079,6 +1079,10 @@ static inline switch_bool_t switch_is_file_path(const char *file)
const char *e;
int r;
if (zstr(file)) {
return SWITCH_FALSE;
}
while(*file == '{') {
if ((e = switch_find_end_paren(file, '{', '}'))) {
file = e + 1;
@ -1087,13 +1091,12 @@ static inline switch_bool_t switch_is_file_path(const char *file)
}
#ifdef WIN32
r = (file && (*file == '\\' || *(file + 1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)));
r = (*file == '\\' || *(file + 1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR));
#else
r = (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)));
r = ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR));
#endif
return r ? SWITCH_TRUE : SWITCH_FALSE;
}