[Freeswitch-trunk] [commit] r7027 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/endpoints/mod_portaudio mod/endpoints/mod_sofia mod/languages/mod_spidermonkey
Freeswitch SVN
mikej at freeswitch.org
Sat Dec 29 19:22:52 EST 2007
Author: mikej
Date: Sat Dec 29 19:22:51 2007
New Revision: 7027
Modified:
freeswitch/trunk/src/include/switch_utils.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/switch_config.c
freeswitch/trunk/src/switch_ivr_play_say.c
freeswitch/trunk/src/switch_loadable_module.c
freeswitch/trunk/src/switch_xml.cpp
Log:
don't strstr on null/blank strings.
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Sat Dec 29 19:22:51 2007
@@ -50,9 +50,9 @@
codec->implementation->samples_per_second, \
codec->implementation->microseconds_per_frame / 1000)
#ifdef WIN32
-#define switch_is_file_path(file) (*file == '\\' || *(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR))
+#define switch_is_file_path(file) (file && (*file == '\\' || *(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)))
#else
-#define switch_is_file_path(file) ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR))
+#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
#endif
SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Sat Dec 29 19:22:51 2007
@@ -3498,9 +3498,9 @@
const char *modified_cmdline = cmdline;
const char *cmd = conf_api_sub_commands[i].pname;
- if ((start_text = strstr(modified_cmdline, cmd))) {
+ if (!switch_strlen_zero(modified_cmdline) && (start_text = strstr(modified_cmdline, cmd))) {
modified_cmdline = start_text + strlen(cmd);
- while (modified_cmdline && *modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
+ while (modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
modified_cmdline++;
}
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Sat Dec 29 19:22:51 2007
@@ -1016,7 +1016,7 @@
if (switch_strlen_zero(name)) {
match = 1;
- } else if (strstr(pdi->name, name)) {
+ } else if (pdi && pdi->name && strstr(pdi->name, name)) {
match = 1;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Sat Dec 29 19:22:51 2007
@@ -1275,7 +1275,7 @@
const char *subject = "n/a";
char *msg = NULL;
- if (sip->sip_content_type) {
+ if (sip->sip_content_type && !switch_strlen_zero(sip->sip_content_type->c_subtype)) {
if (strstr(sip->sip_content_type->c_subtype, "composing")) {
return;
}
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sat Dec 29 19:22:51 2007
@@ -1027,7 +1027,7 @@
if ((mods = switch_xml_child(cfg, "modules"))) {
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
const char *val = switch_xml_attr_soft(ld, "module");
- if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
+ if (!switch_strlen_zero(val) && strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
Modified: freeswitch/trunk/src/switch_config.c
==============================================================================
--- freeswitch/trunk/src/switch_config.c (original)
+++ freeswitch/trunk/src/switch_config.c Sat Dec 29 19:22:51 2007
@@ -68,7 +68,7 @@
cfg->path = path;
while (switch_config_next_pair(cfg, &var, &val)) {
- if ((cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
+ if (file_path && (cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
cfg->lockto = cfg->sectno;
return 1;
}
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Sat Dec 29 19:22:51 2007
@@ -695,7 +695,7 @@
timer_name = switch_channel_get_variable(channel, "timer_name");
- if (!file) {
+ if (switch_strlen_zero(file)) {
status = SWITCH_STATUS_FALSE;
goto end;
}
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Sat Dec 29 19:22:51 2007
@@ -983,7 +983,7 @@
if ((mods = switch_xml_child(cfg, "modules"))) {
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
const char *val = switch_xml_attr_soft(ld, "module");
- if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
+ if (switch_strlen_zero(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
@@ -1003,7 +1003,7 @@
if ((mods = switch_xml_child(cfg, "modules"))) {
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
const char *val = switch_xml_attr_soft(ld, "module");
- if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
+ if (switch_strlen_zero(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
@@ -1043,7 +1043,7 @@
continue;
}
- if (!strstr(fname, ext) && !strstr(fname, EXT)) {
+ if (switch_strlen_zero(fname) || (!strstr(fname, ext) && !strstr(fname, EXT))) {
continue;
}
Modified: freeswitch/trunk/src/switch_xml.cpp
==============================================================================
--- freeswitch/trunk/src/switch_xml.cpp (original)
+++ freeswitch/trunk/src/switch_xml.cpp Sat Dec 29 19:22:51 2007
@@ -1402,7 +1402,7 @@
if (user_name) {
- if (strstr(xtra_params, "mailbox")) {
+ if (!switch_strlen_zero(xtra_params) && strstr(xtra_params, "mailbox")) {
if ((*user = switch_xml_find_child(*domain, "user", "mailbox", user_name))) {
return SWITCH_STATUS_SUCCESS;
}
More information about the Freeswitch-trunk
mailing list