From 50af087b9f3831285869dc8d8bf91cc3e6d5169a Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Thu, 23 Oct 2008 06:56:41 +0000 Subject: fix possible crash when regex function doesn't match (set to *default*) --- utility/database.c | 2 +- utility/logparse.c | 3 +++ utility/mod_log_sql.conf | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'utility') diff --git a/utility/database.c b/utility/database.c index e7650aa..a979268 100644 --- a/utility/database.c +++ b/utility/database.c @@ -19,7 +19,7 @@ apr_status_t database_connect(config_t *cfg) { apr_status_t rv; if (!cfg->dbconn) { - cfg->dbconn = apr_palloc(cfg->pool, sizeof(config_dbd_t)); + cfg->dbconn = apr_pcalloc(cfg->pool, sizeof(config_dbd_t)); } rv = apr_dbd_get_driver(cfg->pool, cfg->dbdriver, &(cfg->dbconn->driver)); if (rv) diff --git a/utility/logparse.c b/utility/logparse.c index e9ca340..dfe2e9b 100644 --- a/utility/logparse.c +++ b/utility/logparse.c @@ -40,6 +40,8 @@ static apr_status_t parser_func_regexmatch(apr_pool_t *p, config_t *cfg, if (!ap_regexec(data->rx, value, AP_MAX_REG_MATCH, regm, 0)) { *ret = ap_pregsub(p, data->substr, value, AP_MAX_REG_MATCH, regm); + } else { + *ret = field->def; } //printf("We matched %s against %s to %s\n",value, field->args[0], *ret); return APR_SUCCESS; @@ -51,6 +53,7 @@ static apr_status_t parser_func_totimestamp(apr_pool_t *p, config_t *cfg, time_t time; struct tm ts; + //memset(&ts,0,sizeof(struct tm)); strptime(value, "%d/%b/%Y:%H:%M:%S %z", &ts); time = mktime(&ts); diff --git a/utility/mod_log_sql.conf b/utility/mod_log_sql.conf index 9730983..bd8496c 100644 --- a/utility/mod_log_sql.conf +++ b/utility/mod_log_sql.conf @@ -2,7 +2,6 @@ InputDirectory ./logs ErrorLog ./error_log DBDDriver mysql DBDParams "host=localhost;user=root;dbname=apache_log" -DBParam socketfile /tmp/mysql.sock Table access_log MachineID 7of9 UseTransactions on -- cgit