<br><font size=2 face="sans-serif">Hi</font>
<br>
<br><font size=2 face="sans-serif">We have some users who are supplying
very long, broken contact details (from Cisco 7912 phones):</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; Apr 25 11:29:46 WARNING[1480]
chan_sip.c: No closing bracket found in '1st Floor Scanner - 137 &lt;sip:xxxxxxxx@yyy.yy.yyy.yyy:5060;user=phone;transport='</font>
<br><font size=2 face="sans-serif">&nbsp; Apr 25 11:29:46 NOTICE[1480]
chan_sip.c: '1st Floor Scanner - 137 &lt;sip:xxxxxxxx@yyy.yy.yyy.yyy:5060;user=phone;transport='
is not a valid SIP contact (missing sip:) trying to use anyway</font>
<br>
<br><font size=2 face="sans-serif">Any ideas how to stop this? Most of
the time it's harmless but some make the SQL queries so long they overflows
sql in res_config.c:</font>
<br>
<br><font size=2 face="sans-serif">static struct ast_variable *realtime_mysql(..)
{</font>
<br><font size=2 face="sans-serif">&nbsp; char sql[256];</font>
<br><font size=2 face="sans-serif">&nbsp; ..</font>
<br><font size=2 face="sans-serif">&nbsp; snprintf(sql, sizeof(sql), &quot;SELECT
* FROM %s WHERE %s%s '%s'&quot;, table, newparam, op, newval);</font>
<br><font size=2 face="sans-serif">&nbsp; ..</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br><font size=2 face="sans-serif">then:</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; Apr 25 11:29:46 DEBUG[1480] res_config_mysql.c:
MySQL RealTime: Update SQL: UPDATE sip SET ipaddr = 'yyy.yy.yyy.yyy', port
= '25766', regseconds = '1145963986', username = '1st Floor Scanner - 137
&lt;sip:xxxxxxxx', fullcontact = '1st Floor Scanner - 137 &lt;sip:xxxxxxxx@yyy.yy.yyy.yyy:5060;user=phone;transport='
WHERE name = '84410662</font>
<br><font size=2 face="sans-serif">&nbsp; Apr 25 11:29:46 DEBUG[1480] res_config_mysql.c:
MySQL RealTime: Query Failed because: You have an error in your SQL syntax;
check the manual that corresponds</font>
<br><font size=2 face="sans-serif">&nbsp;to your MySQL server version for
the right syntax to use near ''84410662' at line 1</font>
<br>
<br><font size=2 face="sans-serif">The query is 257 bytes so the last quote
is truncated and the update fails.</font>
<br>
<br><font size=2 face="sans-serif">Should I submit a patch? If nothing
else it'd be nice to check that the query fits into sql and complain if
it doesn't.</font>
<br>
<br><font size=2 face="sans-serif">Cheers,</font>
<br>
<br><font size=2 face="sans-serif">Mark Drayton</font>
<table><tr><td bgcolor=#ffffff><font color=#000000><pre>This message and any attachment are confidential and may be privileged or
otherwise protected from disclosure.  If you are not the intended
recipient, please telephone or email the sender and delete this message
and any attachment(s) from your system and do not disclose its contents to any
third parties.
</pre></font></td></tr></table>