]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Leave room for switch_escape_string to add a terminating null
authorTravis Cross <tc@traviscross.com>
Sat, 25 May 2013 23:28:55 +0000 (23:28 +0000)
committerTravis Cross <tc@traviscross.com>
Sat, 25 May 2013 23:29:48 +0000 (23:29 +0000)
Thanks-to: Nathan Neulinger <nneul@mst.edu>
FS-5448 --resolve

src/mod/applications/mod_commands/mod_commands.c
src/switch_utils.c

index 0e7cb74f901c430dcc3f5706e344ac9e91d1daeb..cee34281177883175dcbc3f6c7f21d6357dc2a52 100644 (file)
@@ -5521,7 +5521,7 @@ SWITCH_STANDARD_API(escape_function)
                return SWITCH_STATUS_SUCCESS;
        }
 
-       len = (int)strlen(cmd) * 2;
+       len = (int)strlen(cmd) * 2 + 1;
        mycmd = malloc(len);
 
        stream->write_function(stream, "%s", switch_escape_string(cmd, mycmd, len));
index 77f38badbec0199d3bde08c736494a8157eecd6d..ddfe0931a02aee4cfa23ef72907a082202085b0c 100644 (file)
@@ -2077,7 +2077,7 @@ SWITCH_DECLARE(char *) switch_escape_string(const char *in, char *out, switch_si
 
 SWITCH_DECLARE(char *) switch_escape_string_pool(const char *in, switch_memory_pool_t *pool)
 {
-       int len = strlen(in) * 2;
+       int len = strlen(in) * 2 + 1;
        char *buf = switch_core_alloc(pool, len);
        return switch_escape_string(in, buf, len);
 }