[Kamailio-Devel] issue in db_text, revised patch included

Edgar Holleis edgar at indoktrination.at
Wed Feb 25 20:25:26 CET 2009


Of course I mean the sign-function, not abs()!





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 sign().

cheers,
Edgar Holleis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbt_res.c.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
Url : http://lists.kamailio.org/pipermail/devel/attachments/20090225/879cd882/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/879cd882/attachment-0001.bin 


More information about the Devel mailing list