diff options
Diffstat (limited to 'funcs/func_curl.c')
-rw-r--r-- | funcs/func_curl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/funcs/func_curl.c b/funcs/func_curl.c index d10209822..9d6a0c846 100644 --- a/funcs/func_curl.c +++ b/funcs/func_curl.c @@ -477,8 +477,11 @@ static int acf_curl_exec(struct ast_channel *chan, const char *cmd, char *info, struct ast_str *fields = ast_str_create(ast_str_strlen(str) / 2); struct ast_str *values = ast_str_create(ast_str_strlen(str) / 2); int rowcount = 0; - while ((piece = strsep(&remainder, "&"))) { + while (fields && values && (piece = strsep(&remainder, "&"))) { char *name = strsep(&piece, "="); + if (!piece) { + piece = ""; + } ast_uri_decode(piece); ast_uri_decode(name); ast_str_append(&fields, 0, "%s%s", rowcount ? "," : "", name); |