summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2011-09-21 20:53:13 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2011-09-21 20:53:13 +0000
commit4310b5ad5994c52b50eab0e304362a7baa9a5cb7 (patch)
treee6383413a179249fcd0250348fa2e33b1bac87e9 /funcs
parent2bb0d456eb60b3c2caa89945417694e04ff29561 (diff)
................
........ Escape commas in keys and values, when keys and values are enumerated by commas. Review: https://reviewboard.asterisk.org/r/1433 ........ Merged revisions 337325 from https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ Merged revisions 337342 from https://origsvn.digium.com/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_curl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/funcs/func_curl.c b/funcs/func_curl.c
index 7e97eb56e..8f49c16a6 100644
--- a/funcs/func_curl.c
+++ b/funcs/func_curl.c
@@ -564,9 +564,11 @@ static void curl_instance_cleanup(void *data)
}
AST_THREADSTORAGE_CUSTOM(curl_instance, curl_instance_init, curl_instance_cleanup);
+AST_THREADSTORAGE(thread_escapebuf);
static int acf_curl_helper(struct ast_channel *chan, const char *cmd, char *info, char *buf, struct ast_str **input_str, ssize_t len)
{
+ struct ast_str *escapebuf = ast_str_thread_get(&thread_escapebuf, 16);
struct ast_str *str = ast_str_create(16);
int ret = -1;
AST_DECLARE_APP_ARGS(args,
@@ -587,6 +589,11 @@ static int acf_curl_helper(struct ast_channel *chan, const char *cmd, char *info
return -1;
}
+ if (!escapebuf) {
+ ast_free(str);
+ return -1;
+ }
+
if (ast_strlen_zero(info)) {
ast_log(LOG_WARNING, "CURL requires an argument (URL)\n");
ast_free(str);
@@ -670,8 +677,8 @@ static int acf_curl_helper(struct ast_channel *chan, const char *cmd, char *info
}
ast_uri_decode(name, ast_uri_http);
}
- ast_str_append(&fields, 0, "%s%s", rowcount ? "," : "", name);
- ast_str_append(&values, 0, "%s%s", rowcount ? "," : "", S_OR(piece, ""));
+ ast_str_append(&fields, 0, "%s%s", rowcount ? "," : "", ast_str_set_escapecommas(&escapebuf, 0, name, INT_MAX));
+ ast_str_append(&values, 0, "%s%s", rowcount ? "," : "", ast_str_set_escapecommas(&escapebuf, 0, S_OR(piece, ""), INT_MAX));
rowcount++;
}
pbx_builtin_setvar_helper(chan, "~ODBCFIELDS~", ast_str_buffer(fields));