From: Jan Engelhardt <jengelh@inai.de>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/3] sqlite: resolve compiler warnings
Date: Tue, 5 Jun 2012 10:41:01 +0200 [thread overview]
Message-ID: <1338885663-30131-2-git-send-email-jengelh@inai.de> (raw)
In-Reply-To: <1338885663-30131-1-git-send-email-jengelh@inai.de>
In file included from /usr/include/string.h:642:0,
from ulogd_output_SQLITE3.c:34:
In function 'strncat',
inlined from 'db_count_cols' at ulogd_output_SQLITE3.c:306:9,
inlined from 'sqlite3_init_db' at ulogd_output_SQLITE3.c:328:11:
/usr/include/bits/string3.h:152:3: warning: call to __builtin___strncat_chk might overflow destination buffer [enabled by default]
I: Statement might be overflowing a buffer in strncat. Common mistake:
BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the left over size as 3rd argument
GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1)
E: ulogd2 bufferoverflowstrncat ulogd_output_SQLITE3.c:328:11
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
output/sqlite3/ulogd_output_SQLITE3.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/output/sqlite3/ulogd_output_SQLITE3.c b/output/sqlite3/ulogd_output_SQLITE3.c
index 3cd2106..dffdda3 100644
--- a/output/sqlite3/ulogd_output_SQLITE3.c
+++ b/output/sqlite3/ulogd_output_SQLITE3.c
@@ -303,7 +303,7 @@ db_count_cols(struct ulogd_pluginstance *pi, sqlite3_stmt **stmt)
struct sqlite3_priv *priv = (void *)pi->private;
char query[SELECT_ALL_LEN + CONFIG_VAL_STRING_LEN] = SELECT_ALL_STR;
- strncat(query, table_ce(pi), LINE_LEN);
+ strncat(query, table_ce(pi), sizeof(query) - strlen(query) - 1);
if (sqlite3_prepare(priv->dbh, query, -1, stmt, 0) != SQLITE_OK)
return -1;
--
1.7.7
next prev parent reply other threads:[~2012-06-05 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-05 8:41 ulogd: build fixes Jan Engelhardt
2012-06-05 8:41 ` Jan Engelhardt [this message]
2012-06-05 8:41 ` [PATCH 2/3] nfacct: resolve build failure Jan Engelhardt
2012-06-05 8:41 ` [PATCH 3/3] pcap: resolve unreliable detection Jan Engelhardt
2012-06-05 17:01 ` ulogd: build fixes 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=1338885663-30131-2-git-send-email-jengelh@inai.de \
--to=jengelh@inai.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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;
as well as URLs for NNTP newsgroup(s).