[freetds] [ freetds-Patches-731907 ] Choosing datalength when binding fixed types

SourceForge.net noreply at sourceforge.net
Sat May 3 14:12:11 EDT 2003


Patches item #731907, was opened at 2003-05-03 18:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=731907&group_id=33106

Category: db-lib
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Arnar Birgisson (arnar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Choosing datalength when binding fixed types

Initial Comment:
When binding parameters of fixed-length types in dblib,
the parameter "datalen" passed to dbrpcparam should be
(almost) ignored.

Current FreeTDS behaviour is to use the datalen
parameter to determine how many bytes to copy from the
parameter into the rpc message. Sybase and mssql
documentation state that for fixed types, datalen
should be set to -1, and when freetds passes -1 to
memcpy, the application segfaults.

This patch changes param_info_alloc, which is called
from dprpcparam, to check if we are dealing with a
fixed-size type, and if so, then it uses
tds_get_size_by_type to set the relevant member in
TDSCOLINFO and pass to memcpy.

In the case of variable-sized types, the original
behaviour is pertained.

This should fix my earlier reported bug no. 731810, but
I don't know if it breaks anything else.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=731907&group_id=33106



More information about the FreeTDS mailing list