Menu

#9 SQL query buffers too small

open
nobody
None
5
2004-11-24
2004-11-24
No

The SQL query buffers are too small for some queries.
The longest SQL query implicitly avilable are:

SQL_BUF_SIZE =
length("SELECT FROM WHERE = ''") (25) +
MAXNAME (256) + // Max sendmail key length
maxlength(map+lhs+rhs) (3 * SQL_BUF_SIZE (128)) +
\0 (1) // termination
= 666 < 128 (Default value)

But this is recursive (depends of SQL_BUF_SIZE it self).

With even relativ reasnoable table and field names, this
causes long e-mail addresse (often mailling-list bounce
addresses) to cause a truncatination of the SQL query,
causing not only a failed query, but an SQL error since
the terminatinc quote is truncated. causing loglines like:

Nov 24 14:12:27 sendmail[31328]: Error fetching query
result from server: You have an error in your SQL
syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use
near ''from:sentto-23456789-415-1101215507-
abcdefghijk=inet.abc.zz@returns.abc' at line 1

I believe the strcpy of the table and lhs/rhs names
should have a reasonable lower max field-length and
then calculate SQL_BUF_SIZE based on this and the
formula abover.

/Regards
Martin Lorensen

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.