[OpenSIPS-Devel] [ opensips-Bugs-2721023 ] strtok in db_berkeley

SourceForge.net noreply at sourceforge.net
Sun Mar 29 19:46:20 CEST 2009


Bugs item #2721023, was opened at 2009-03-29 17:46
Message generated for change (Tracker Item Submitted) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2721023&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: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: strtok in db_berkeley

Initial Comment:
db_berkeley uses pipe character (|) as a field delimiter in a row (row is just a character string). But for parsing the row it uses function strtok(row,"|") which will lead to errors when we have sequences of two and more pipes (i.e. the fields values between them are empty strings), because strtok never returns empty strings and proceeds to the next until non-empty token will be found. So it will result in a  the wrong number of fields in processed row.

It would be better to switch to strsep function which process tokens one in a time.   

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

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



More information about the Devel mailing list