[EMAIL PROTECTED] wrote:
> I've checked in the patched version. Eddy, if you have some time on
> your hands, please try to build from the cvs sources to make sure
> everything is ok now.
>
> regards,
> Markus
>
>   
See also:
http://lists.ibiblio.org/pipermail/freetds/2008q2/023518.html

My patch for freetds was rejected.
I found a way to fix the problem with a second patch in the dbd driver 
instead.
freetds gives us datafmt which has maxlength. The we set format to 
CS_FMT_NULLTERM on the same instance of datafmt to pass it to bind later.
When the row is fetched it uses this maxlength as destlen to copy the 
content. By increasing it with 1 byte there is place to write the '\0'.

diff --git a/drivers/freetds/dbd_freetds.c b/drivers/freetds/dbd_freetds.c
index 2eb05e1..449c313 100644
--- a/drivers/freetds/dbd_freetds.c
+++ b/drivers/freetds/dbd_freetds.c
@@ -825,6 +825,7 @@ void _translate_freetds_type(CS_DATAFMT * datafmt, 
unsigned short *type, unsigne
     case CS_VARCHAR_TYPE:
     _type = DBI_TYPE_STRING;
     datafmt->format = CS_FMT_NULLTERM;
+    ++datafmt->maxlength; /* 1 extra byte for \0 */
     break;
     case CS_MONEY_TYPE:    /* 8 */
     case CS_MONEY4_TYPE:    /* 4 */
-- 

I tested this with the latest cvs sources  as requested.

Eddy

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Libdbi-drivers-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to