]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
CID-1294436: handle null file paths to switch_is_file_path correctly
authorMichael Jerris <mike@jerris.com>
Thu, 23 Apr 2015 14:52:25 +0000 (10:52 -0400)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:47:25 +0000 (12:47 -0500)
src/include/switch_utils.h

index dc197415a65f0f1113a96538700e4025dc747960..2c9e0a2aaa5a0837a6c2d61e83e3c95c77a4a3e9 100644 (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;
-
 }