[Kamailio-Devel] issue in db_text, patch included

Edgar Holleis edgar at indoktrination.at
Wed Feb 25 19:48:32 CET 2009


Dear list,

db_text's query function returns bad results if called with the
operators '<', '<=', '>' and '>=' on text columns. 

Description of the bug in dbt_res.c:

- dbt_row_match() calls dbt_cmp_val() and expects -1, 0, or 1 in return

- dbt_cmp_val() calls strncasecmp() and fails to take into account that
  the latter returns "a positive integer" or "a negative integer" to
  indicate bigger or smaller.

The patch passes the result of strncasecmp() through abs().

cheers,
Edgar Holleis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbt_res.c.patch
Type: text/x-patch
Size: 1144 bytes
Desc: not available
Url : http://lists.kamailio.org/pipermail/devel/attachments/20090225/cbbed03e/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2834 bytes
Desc: not available
Url : http://lists.kamailio.org/pipermail/devel/attachments/20090225/cbbed03e/attachment-0001.bin 


More information about the Devel mailing list