[ulogd2] Fix computation of allocated size for query

Pablo Neira netfilter-cvslog-bounces at lists.netfilter.org
Thu Jul 10 08:32:04 CEST 2008


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=ulogd2.git;a=commit;h=fc0ae6727593549b62c765e445f3724536911038
commit fc0ae6727593549b62c765e445f3724536911038
Author:     Eric Leblond <eric at inl.fr>
AuthorDate: Thu Jul 10 08:31:55 2008 +0200
Commit:     Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Thu Jul 10 08:31:55 2008 +0200

    Fix computation of allocated size for query
    
    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 at inl.fr>
       via  fc0ae6727593549b62c765e445f3724536911038 (commit)
      from  0b916d0556c67a1f3bb75a0cf2ed4c252ea76235 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fc0ae6727593549b62c765e445f3724536911038
Author: Eric Leblond <eric at inl.fr>
Date:   Thu Jul 10 08:31:55 2008 +0200

    Fix computation of allocated size for query
    
    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 at inl.fr>

-----------------------------------------------------------------------

 util/db.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
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 at inl.fr>

diff --git a/util/db.c b/util/db.c
index 3cfe057..5cf5fe1 100644
--- 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);
 



More information about the netfilter-cvslog mailing list