From: Eric Leblond <eric@inl.fr>
To: netfilter-devel@vger.kernel.org
Cc: Eric Leblond <eric@inl.fr>
Subject: [ULOGD2 PATCH 2/2] Fix computation of allocated size for query.
Date: Wed, 9 Jul 2008 22:56:45 +0200 [thread overview]
Message-ID: <1215637005-3102-3-git-send-email-eric@inl.fr> (raw)
In-Reply-To: <1215637005-3102-2-git-send-email-eric@inl.fr>
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 | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
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);
--
1.5.5.1
next prev parent reply other threads:[~2008-07-09 20:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-09 20:56 [ULOGD2 PATCH 0/2] Misc cleaning Eric Leblond
2008-07-09 20:56 ` [ULOGD2 PATCH 1/2] Suppress subversion specific dist-hook Eric Leblond
2008-07-09 20:56 ` Eric Leblond [this message]
2008-07-10 6:33 ` [ULOGD2 PATCH 2/2] Fix computation of allocated size for query Pablo Neira Ayuso
2008-07-10 6:29 ` [ULOGD2 PATCH 1/2] Suppress subversion specific dist-hook Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1215637005-3102-3-git-send-email-eric@inl.fr \
--to=eric@inl.fr \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox