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.
Patch to fix dbrpcparams interpretation of datalen