]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
Fix computation of allocated size for query
authorEric Leblond <eric@inl.fr>
Thu, 10 Jul 2008 06:31:55 +0000 (08:31 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 10 Jul 2008 06:31:55 +0000 (08:31 +0200)
This patch fixes the computation of the allocation size for the query.
It was not taking into account the length of the name of the procedure.

Signed-off-by: Eric Leblond <eric@inl.fr>
util/db.c

index 3cfe05737cac651a3fa6933bb0e56ade0bc6bebf..5cf5fe191c963f8d1fea3789c2d88e526d4a655e 100644 (file)
--- a/util/db.c
+++ b/util/db.c
@@ -54,7 +54,7 @@ static int disabled_interp_db(struct ulogd_pluginstance *upi)
        return 0;
 }
 
-#define SQL_INSERTTEMPL   "insert into X (Y) values (Z)"
+#define SQL_INSERTTEMPL   "SELECT P(Y)"
 #define SQL_VALSIZE    100
 
 /* create the static part of our insert statement */
@@ -80,7 +80,8 @@ static int sql_createstmt(struct ulogd_pluginstance *upi)
                /* we need space for the key and a comma, as well as
                 * enough space for the values */
                size += strlen(upi->input.keys[i].name) + 1 + SQL_VALSIZE;
-       }       
+       }
+       size += srtlen(procedure);
 
        ulogd_log(ULOGD_DEBUG, "allocating %u bytes for statement\n", size);