[Freeswitch-svn] [commit] r8776 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Fri Jun 6 09:43:42 EDT 2008


Author: anthm
Date: Fri Jun  6 09:43:41 2008
New Revision: 8776

Modified:
   freeswitch/trunk/src/switch_channel.c

Log:
add patch from FSCORE-136

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Fri Jun  6 09:43:41 2008
@@ -1599,8 +1599,8 @@
 	char *p, *c = NULL;
 	char *data, *indup;
 	size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
-	const char *q, *sub_val = NULL;
-	char *cloned_sub_val = NULL;
+	const char *q;
+	char *cloned_sub_val = NULL, *sub_val = NULL;
 	char *func_val = NULL;
 	int nv = 0;
 
@@ -1743,7 +1743,7 @@
 						}
 					}
 
-					if ((sub_val = switch_channel_get_variable(channel, vname))) {
+					if ((sub_val = (char *) switch_channel_get_variable(channel, vname))) {
 						if (offset || ooffset) {
 							cloned_sub_val = strdup(sub_val);
 							switch_assert(cloned_sub_val);
@@ -1751,7 +1751,11 @@
 						}
 
 						if (offset >= 0) {
-							sub_val += offset;
+							if (offset > strlen(sub_val)) {
+								*sub_val = '\0';
+							} else {
+								sub_val += offset;
+							}
 						} else if ((size_t) abs(offset) <= strlen(sub_val)) {
 							sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset);
 						}



More information about the Freeswitch-svn mailing list