Diff
Modified: freeswitch/trunk/src/include/switch_mprintf.h (16881 => 16882)
--- freeswitch/trunk/src/include/switch_mprintf.h 2010-03-03 17:43:28 UTC (rev 16881)
+++ freeswitch/trunk/src/include/switch_mprintf.h 2010-03-03 18:31:19 UTC (rev 16882)
@@ -57,6 +57,7 @@
*/
SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...);
SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap);
+SWITCH_DECLARE(char *) switch_snprintfv(char *zBuf, int n, const char *zFormat, ...);
SWITCH_END_EXTERN_C
#endif /* SWITCH_MPRINTF_H */
Modified: freeswitch/trunk/src/include/switch_utils.h (16881 => 16882)
--- freeswitch/trunk/src/include/switch_utils.h 2010-03-03 17:43:28 UTC (rev 16881)
+++ freeswitch/trunk/src/include/switch_utils.h 2010-03-03 18:31:19 UTC (rev 16882)
@@ -104,7 +104,7 @@
while (i && *i == '\\') {
i++;
- if (*i == '\\' || *i == 'n' || *i == 's' || *i == 't') {
+ if (*i == '\\' || *i == 'n' || *i == 's' || *i == 't' || *i == '\'') {
return 1;
}
i = strchr(i, '\\');
Modified: freeswitch/trunk/src/switch_caller.c (16881 => 16882)
--- freeswitch/trunk/src/switch_caller.c 2010-03-03 17:43:28 UTC (rev 16881)
+++ freeswitch/trunk/src/switch_caller.c 2010-03-03 18:31:19 UTC (rev 16882)
@@ -415,6 +415,13 @@
va_end(ap);
if (data) {
+ char *p;
+
+ if ((p = strstr(data, "\\'"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n", data);
+ free(data);
+ return;
+ }
switch_caller_extension_add_application(session, caller_extension, application_name, data);
free(data);
}
@@ -426,12 +433,22 @@
const char *application_data)
{
switch_caller_application_t *caller_application = NULL;
+ char *p;
switch_assert(session != NULL);
if ((caller_application = switch_core_session_alloc(session, sizeof(switch_caller_application_t))) != 0) {
caller_application->application_name = switch_core_session_strdup(session, application_name);
caller_application->application_data = switch_core_session_strdup(session, application_data);
+
+
+
+ if ((p = strstr(caller_application->application_data, "\\'"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "App not added, Invalid character sequence in data string [%s]\n",
+ caller_application->application_data);
+ return;
+ }
+
if (!caller_extension->applications) {
caller_extension->applications = caller_application;
} else if (caller_extension->last_application) {
Modified: freeswitch/trunk/src/switch_channel.c (16881 => 16882)
--- freeswitch/trunk/src/switch_channel.c 2010-03-03 17:43:28 UTC (rev 16881)
+++ freeswitch/trunk/src/switch_channel.c 2010-03-03 18:31:19 UTC (rev 16882)
@@ -2438,6 +2438,9 @@
if (*(p + 1) == '$') {
nv = 1;
p++;
+ } else if (*(p + 1) == '\'') {
+ p++;
+ continue;
} else if (*(p + 1) == '\\') {
*c++ = *p++;
len++;
Modified: freeswitch/trunk/src/switch_event.c (16881 => 16882)
--- freeswitch/trunk/src/switch_event.c 2010-03-03 17:43:28 UTC (rev 16881)
+++ freeswitch/trunk/src/switch_event.c 2010-03-03 18:31:19 UTC (rev 16882)
@@ -1395,6 +1395,9 @@
if (*(p + 1) == '$') {
nv = 1;
p++;
+ } else if (*(p + 1) == '\'') {
+ p++;
+ continue;
} else if (*(p + 1) == '\\') {
*c++ = *p++;
len++;
Modified: freeswitch/trunk/src/switch_mprintf.c (16881 => 16882)
--- freeswitch/trunk/src/switch_mprintf.c 2010-03-03 17:43:28 UTC (rev 16881)
+++ freeswitch/trunk/src/switch_mprintf.c 2010-03-03 18:31:19 UTC (rev 16882)
@@ -872,30 +872,6 @@
}
/*
-** Print into memory. Use the internal %-conversion extensions.
-*/
-SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
-{
- char zBase[SWITCH_PRINT_BUF_SIZE];
- return base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
-}
-
-/*
-** Print into memory. Use the internal %-conversion extensions.
-*/
-SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
-{
- va_list ap;
- char *z;
- char zBase[SWITCH_PRINT_BUF_SIZE];
- va_start(ap, zFormat);
- z = base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
- va_end(ap);
- return z;
-}
-
-#ifdef __UNUSED__
-/*
** Print into memory. Omit the internal %-conversion extensions.
*/
SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
@@ -924,7 +900,7 @@
** are not able to use a "," as the decimal point in place of "." as
** specified by some locales.
*/
-SWITCH_DECLARE(char *) switch_snprintf(int n, char *zBuf, const char *zFormat, ...)
+SWITCH_DECLARE(char *) switch_snprintfv(char *zBuf, int n, const char *zFormat, ...)
{
char *z;
va_list ap;
@@ -934,4 +910,4 @@
va_end(ap);
return z;
}
-#endif
+