aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authoranthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b>2004-10-27 01:34:06 +0000
committeranthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b>2004-10-27 01:34:06 +0000
commit159d6538555df5962137219c1591610158ec8ced (patch)
tree1b54a320be7131802e09be2a1db1f7f913412e24 /pbx.c
parente2c75a92f97e22fed0bd2017fccb550fc2106ba3 (diff)
add more paranoid handling to pbx_builtin_serialize_variables
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4107 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/pbx.c b/pbx.c
index e40746d93..c6d7e3f1e 100755
--- a/pbx.c
+++ b/pbx.c
@@ -4921,18 +4921,21 @@ int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t
{
struct ast_var_t *variables;
struct varshead *headp;
+ char *var=NULL ,*val=NULL;
int total = 0;
memset(buf,0,size);
if (chan) {
headp=&chan->varshead;
AST_LIST_TRAVERSE(headp,variables,entries) {
- snprintf(buf + strlen(buf), size - strlen(buf), "%s=%s\n", ast_var_name(variables), ast_var_value(variables));
- if(strlen(buf) >= size) {
- ast_log(LOG_ERROR,"Data Buffer Size Exceeded!\n");
- break;
+ if(chan && variables && (var=ast_var_name(variables)) && (val=ast_var_value(variables))) {
+ snprintf(buf + strlen(buf), size - strlen(buf), "%s=%s\n", var, val);
+ if(strlen(buf) >= size) {
+ ast_log(LOG_ERROR,"Data Buffer Size Exceeded!\n");
+ break;
+ }
+ total++;
}
- total++;
}
}