From 5b5aad08cbdee605fef63d30553f66b87c641e9e Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Wed, 19 Dec 2012 15:27:41 +0000 Subject: [PATCH] Fix possible SEGVs by changing the nByte parameter of sqlite3_prepare_v2(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Segmentation Faults reported and observed under high traffic.  For some reason this is a previously seen issue with the nBytes parameter of sqlite3_prepare_v2().  Not sure why, but it seems to fix the issue. --- apache/mod_blockinator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apache/mod_blockinator.c b/apache/mod_blockinator.c index 9b9bfda..1aba422 100644 --- a/apache/mod_blockinator.c +++ b/apache/mod_blockinator.c @@ -77,7 +77,7 @@ static int mod_blockinator_method_handler(request_rec *r) statement = sqlite3_mprintf("SELECT * FROM blocklist WHERE remote_ip = '%q' AND (forwarded_ip = 'ANY' OR forwarded_ip = '%q') AND (useragent = 'ANY' OR useragent = '%q')", remote_ip, forwarded_ip, useragent); /* Prepare the statement */ - sqlite3_rc = sqlite3_prepare_v2(db, statement, BUFSIZ, &sqlite3_statement, NULL); + sqlite3_rc = sqlite3_prepare_v2(db, statement, -1, &sqlite3_statement, NULL); if (sqlite3_rc != SQLITE_OK) { /* SQLite error. Allow. */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "SQLite error (%s). Allow traffic from %s by default.", sqlite3_errmsg(db), remote_ip);