[asterisk-commits] russell: branch 1.4 r49388 -
/branches/1.4/funcs/func_realtime.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Jan 3 21:33:01 MST 2007
Author: russell
Date: Wed Jan 3 22:33:00 2007
New Revision: 49388
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49388
Log:
Fix the REALTIME() dialplan function. ast_build_string() advances the string
pointer to the position to begin the next write into the buffer. So, this
pointer can not be used to copy the contents of the string later. The
beginning of the buffer must be saved. Interestingly enough, this code could
not have ever worked. (Pointed out by Sebb on IRC, thanks!)
Modified:
branches/1.4/funcs/func_realtime.c
Modified: branches/1.4/funcs/func_realtime.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_realtime.c?view=diff&rev=49388&r1=49387&r2=49388
==============================================================================
--- branches/1.4/funcs/func_realtime.c (original)
+++ branches/1.4/funcs/func_realtime.c Wed Jan 3 22:33:00 2007
@@ -49,7 +49,7 @@
{
struct ast_variable *var, *head;
struct ast_module_user *u;
- char *results;
+ char *results, *result_begin;
size_t resultslen = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(family);
@@ -83,10 +83,10 @@
for (var = head; var; var = var->next)
resultslen += strlen(var->name) + strlen(var->value) + 2;
- results = alloca(resultslen);
+ result_begin = results = alloca(resultslen);
for (var = head; var; var = var->next)
ast_build_string(&results, &resultslen, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
- ast_copy_string(buf, results, len);
+ ast_copy_string(buf, result_begin, len);
ast_module_user_remove(u);
More information about the asterisk-commits
mailing list