From: Automerge Script Date: Tue, 29 May 2007 22:24:55 +0000 (+0000) Subject: automerge commit X-Git-Tag: 1.2.19-netsec~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e357e2d87a6b1e2c7369316e6a17775be94dafb;p=thirdparty%2Fasterisk.git automerge commit git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@66584 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/funcs/func_strings.c b/funcs/func_strings.c index 00b6dd1720..0aaf3fc4b0 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -51,7 +51,9 @@ static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data, sprintf(varsubst, "${%s}", varname); pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1); - if (delim) { + if (ast_strlen_zero(varval)) + fieldcount = 0; + else if (delim) { while (strsep(&varval2, delim)) fieldcount++; } else if (!ast_strlen_zero(varval)) { @@ -60,7 +62,7 @@ static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data, snprintf(buf, len, "%d", fieldcount); } else { ast_log(LOG_ERROR, "Out of memory\n"); - strncpy(buf, "1", len); + ast_copy_string(buf, "1", len); } return buf; }