Bugs item #2636665, was opened at 2009-02-25 13:53
Message generated for change (Comment added) made by krokodilerian
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2636665&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: trunk
Status: Open
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Vasil Kolev (krokodilerian)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: Bad parsing of BLOBs in db_postgres+patch

Initial Comment:
Excerpt from the logs:

Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_submit_query: 0x8198488 
PQsendQuery(select 
presentity_uri,expires,event,event_id,to_user,to_domain,watcher_username,watcher_domain,callid,to_tag,from_tag
,local_cseq,remote_cseq,record_route,socket_info,contact,local_contact,version,status,reason
 from active_watchers )
Feb 25 11:09:20 [12106] DBG:core:db_new_result: allocate 28 bytes for result 
set at 0x81984e8
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_fetch_result: 0x8198488 
PQresultStatus(PGRES_TUPLES_OK) PQgetResult(0x9807030)
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_get_columns: 20 columns 
returned from the query
Feb 25 11:09:20 [12106] DBG:core:db_allocate_columns: allocate 320 bytes for 
result columns at 0x8198ae8
...
...
...
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_get_columns: 
RES_NAMES(0x8198bf0)[13]=[record_route]
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_get_columns: use DB_BLOB 
result type
...
...
...
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_convert_rows: allocated 0 
bytes for row_buf[13] at 0x8198c88
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_convert_rows: [0][13] 
Column[record_route]=[]
...
...
...
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_str2val: converting BLOB []
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_str2val: got blob len 0
...
...
...
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_convert_rows: 
PQgetvalue(0x8198488,1,13)=[<98>!<F7><B7><98>!<F7><B7>^P]
Feb 25 11:09:20 [12106] DBG:db_postgres:db_postgres_convert_rows: allocated 9 
bytes for row_buf[13] at 0x819a7a8

Patch should be self-explanatory :)

----------------------------------------------------------------------

>Comment By: Vasil Kolev (krokodilerian)
Date: 2009-02-27 15:17

Message:
Hi Bogdan,

On line 233 of res.c there's
len=strlen(s);

I think that if you just leave the len as it's set in the if() before
that, it would be better. I still am not sure if anything returned from
PQgetvalue() is required to be null-terminated, so just to be on the safe
side, I think taking 'len' from the database is the best choice.

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-02-26 12:18

Message:
Hi Vasil,

I applied the patch on SVN (1.4 and 1.5 vers), but slightly modified -
please update from SVN and test it - I want to be sure I haven't screwed up
something :).

Thanks and regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2636665&group_id=232389

_______________________________________________
Devel mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to