From: Michael Jerris Date: Thu, 23 Apr 2015 14:52:25 +0000 (-0400) Subject: CID-1294436: handle null file paths to switch_is_file_path correctly X-Git-Tag: v1.6.2~614^2~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7709a191bf4c274a05fc0ee2e76a0274821f09d;p=thirdparty%2Ffreeswitch.git CID-1294436: handle null file paths to switch_is_file_path correctly --- diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index dc197415a6..2c9e0a2aaa 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -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; - }