Re: Segfault in 1.99 with CGI Args
"Douglas E. Warner" <[email protected]> Wed, 18 Aug 2004 13:56:11 -0400
| Newsgroups | gmane.comp.apache.mod-log-sql |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 18 August 2004 10:37, Douglas E. Warner wrote: > Trying to help track down what's going on, I ran my config (which I'll > include below) with 'LogLevel debug' in my httpd.conf. Here's the > pertinent info: I think I tracked down the problem; actually, it seemed like a two-part problem: 1) the mysql escape function wasn't matching empty strings by the first 'if' statement, only null strings. 2) when a null string was matched my the mysql escape function, it returned a literal NULL instead of the string 'NULL' which was needed in the insert statement. I've attached my patch; feel free to modify it for your uses, it seems to work for me. - -Doug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBI5g7JV36su0A0xIRAqmZAKDKbr+/trgdM8ZjA+Uqdqv4kzXZowCg4hK1 L62P0AK+9thKMtJOFFCR7Ug= =vJMd -----END PGP SIGNATURE----- _______________________________________________ Download the latest version at http://www.outoforder.cc/projects/apache/mod_log_sql/ To unsubscribe send an e-mail to mod_log_sql-unsubscribe-7qY7E20V6GW73k+5HYS8LQqVMODqnSLI@public.gmane.org
mod_log_sql-1.99-mysql-escape.diff
(text/x-diff, 546 B)
diff -ru mod_log_sql-1.99-orig/mod_log_sql_mysql.c mod_log_sql-1.99/mod_log_sql_mysql.c
--- mod_log_sql-1.99-orig/mod_log_sql_mysql.c 2004-07-15 21:33:59.000000000 -0400
+++ mod_log_sql-1.99/mod_log_sql_mysql.c 2004-08-18 13:22:16.894649408 -0400
@@ -75,8 +75,8 @@
static const char *log_sql_mysql_escape(const char *from_str, apr_pool_t *p,
logsql_dbconnection *db)
{
- if (!from_str)
- return NULL;
+ if (!from_str || strlen(from_str) == 0)
+ return "NULL";
else {
char *to_str;
unsigned long length = strlen(from_str);