From 103d97e208ebffd3d0251b040df128c3952c7463 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sat, 25 May 2013 23:28:55 +0000 Subject: [PATCH] Leave room for switch_escape_string to add a terminating null Thanks-to: Nathan Neulinger FS-5448 --resolve --- src/mod/applications/mod_commands/mod_commands.c | 2 +- src/switch_utils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 0e7cb74f90..cee3428117 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -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)); diff --git a/src/switch_utils.c b/src/switch_utils.c index 77f38badbe..ddfe0931a0 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -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); }