提交 103d97e2 authored 作者: Travis Cross's avatar Travis Cross

Leave room for switch_escape_string to add a terminating null

Thanks-to: Nathan Neulinger <nneul@mst.edu>

FS-5448 --resolve
上级 2870bb92
...@@ -5521,7 +5521,7 @@ SWITCH_STANDARD_API(escape_function) ...@@ -5521,7 +5521,7 @@ SWITCH_STANDARD_API(escape_function)
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
len = (int)strlen(cmd) * 2; len = (int)strlen(cmd) * 2 + 1;
mycmd = malloc(len); mycmd = malloc(len);
stream->write_function(stream, "%s", switch_escape_string(cmd, mycmd, len)); stream->write_function(stream, "%s", switch_escape_string(cmd, mycmd, len));
......
...@@ -2077,7 +2077,7 @@ SWITCH_DECLARE(char *) switch_escape_string(const char *in, char *out, switch_si ...@@ -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) 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); char *buf = switch_core_alloc(pool, len);
return switch_escape_string(in, buf, len); return switch_escape_string(in, buf, len);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论