aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-04-13 16:38:32 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-04-13 16:38:32 +0000
commitd4d5d8e8889d0c2affc6eff74fc87a5e563f3b61 (patch)
tree5cd6246456b8d9b75fdf180b584484c1ef429883
parentd025291e4037d7e2d87fb2cd5cf9a1cd0e7db337 (diff)
Merged revisions 257065 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r257065 | tilghman | 2010-04-13 11:33:21 -0500 (Tue, 13 Apr 2010) | 8 lines Ensure that we can have commas within cdr values. (closes issue #17001) Reported by: snuffy Patches: 20100412__issue17001.diff.txt uploaded by tilghman (license 14) Tested by: snuffy ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@257067 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--cdr/cdr_sqlite3_custom.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c
index 981a2533e..d35fc3670 100644
--- a/cdr/cdr_sqlite3_custom.c
+++ b/cdr/cdr_sqlite3_custom.c
@@ -51,6 +51,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/cli.h"
+#include "asterisk/app.h"
AST_MUTEX_DEFINE_STATIC(lock);
@@ -64,8 +65,8 @@ static char table[80];
static char *columns;
struct values {
- char *expression;
AST_LIST_ENTRY(values) list;
+ char expression[1];
};
static AST_LIST_HEAD_STATIC(sql_values, values);
@@ -121,9 +122,12 @@ static int load_column_config(const char *tmp)
static int load_values_config(const char *tmp)
{
- char *val = NULL;
char *vals = NULL, *save = NULL;
struct values *value = NULL;
+ int i;
+ AST_DECLARE_APP_ARGS(val,
+ AST_APP_ARG(ues)[200]; /* More than 200 columns in this CDR? Yeah, right... */
+ );
if (ast_strlen_zero(tmp)) {
ast_log(LOG_WARNING, "Values not specified. Module not loaded.\n");
@@ -133,17 +137,17 @@ static int load_values_config(const char *tmp)
ast_log(LOG_ERROR, "Out of memory creating temporary buffer for value '%s'\n", tmp);
return -1;
}
- while ((val = strsep(&vals, ","))) {
+ AST_STANDARD_RAW_ARGS(val, vals);
+ for (i = 0; i < val.argc; i++) {
/* Strip the single quotes off if they are there */
- val = ast_strip_quoted(val, "'", "'");
- value = ast_calloc(sizeof(char), sizeof(*value) + strlen(val) + 1);
+ char *v = ast_strip_quoted(val.ues[i], "'", "'");
+ value = ast_calloc(sizeof(char), sizeof(*value) + strlen(v));
if (!value) {
- ast_log(LOG_ERROR, "Out of memory creating entry for value '%s'\n", val);
+ ast_log(LOG_ERROR, "Out of memory creating entry for value '%s'\n", v);
ast_free(save);
return -1;
}
- value->expression = (char *) value + sizeof(*value);
- ast_copy_string(value->expression, val, strlen(val) + 1);
+ strcpy(value->expression, v); /* SAFE */
AST_LIST_INSERT_TAIL(&sql_values, value, list);
}
ast_free(save);