freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "KC" <kcc1967 AT gmail.com>, "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] freetds-0.63 bug & fix
- Date: Fri, 22 Jul 2005 15:01:12 +0200
>
> Hi,
>
> I think I found a bug for freetds-0.63.
> In file freetds-0.63/src/tds/query.c line 1134~1144, function
> tds_put_data(), the orignal code is:
>
> ..........................
> #ifdef WORDS_BIGENDIAN
> unsigned char buf[64];
>
> if (tds->emul_little_endian && colsize < 64) {
> tdsdump_log(TDS_DBG_INFO1, "swapping coltype %d\n",
>
> tds_get_conversion_type(curcol->column_type, colsize));
> memcpy(buf, s, colsize);
>
> tds_swap_datatype(tds_get_conversion_type(curcol->column_type,
> colsize), buf);
> s = buf;
> }
> #endif
> ............................
>
> The "s = buf;" should be replaced by "memcpy(s,buf,colsize);",
> since "buf" is local which is not allocated by malloc(). Use "s=buf"
> will cause following tds_convert_string_free((char*)src, s) try
> to free "s" ... and that will cause Segmentation Fault.
>
>
> Regards,
> KC
>
Good spot!
However I would change if with
if (tds->emul_little_endian && !converted && colsize < 64) {
so to avoid to change row buffer.
freddy77
-
[freetds] freetds-0.63 bug & fix,
KC, 07/22/2005
- <Possible follow-up(s)>
- Re: [freetds] freetds-0.63 bug & fix, ZIGLIO, Frediano, VF-IT, 07/22/2005
Archive powered by MHonArc 2.6.24.