diff options
Diffstat (limited to 'output/mysql/ulogd_output_MYSQL.c')
-rw-r--r-- | output/mysql/ulogd_output_MYSQL.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/output/mysql/ulogd_output_MYSQL.c b/output/mysql/ulogd_output_MYSQL.c index 66151fe..9727e30 100644 --- a/output/mysql/ulogd_output_MYSQL.c +++ b/output/mysql/ulogd_output_MYSQL.c @@ -135,18 +135,18 @@ static int get_columns_mysql(struct ulogd_pluginstance *upi) } for (i = 0; (field = mysql_fetch_field(result)); i++) { - char buf[ULOGD_MAX_KEYLEN+1]; char *underscore; + snprintf(upi->input.keys[i].name, + sizeof(upi->input.keys[i].name), + "%s", field->name); + /* replace all underscores with dots */ - strncpy(buf, field->name, ULOGD_MAX_KEYLEN); - while ((underscore = strchr(buf, '_'))) + for (underscore = upi->input.keys[i].name; + (underscore = strchr(underscore, '_')); ) *underscore = '.'; - DEBUGP("field '%s' found\n", buf); - - /* add it to list of input keys */ - strncpy(upi->input.keys[i].name, buf, ULOGD_MAX_KEYLEN); + DEBUGP("field '%s' found\n", upi->input.keys[i].name); } /* MySQL Auto increment ... ID :) */ upi->input.keys[0].flags |= ULOGD_KEYF_INACTIVE; |