Skip to Content.
Sympa Menu

freetds - Re: [freetds] ODBC SQLSetDescRec fix

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] ODBC SQLSetDescRec fix
  • Date: Mon, 23 Feb 2009 17:17:39 +0100

2009/2/23 Amir Shamsuddin <amirs2+freetds AT gmail.com>:
> Hi,
> I'm using freeTDS with sqlapi and using the odbc interface as recommended by
> sqlapi to connect to a MSSQL server.
>
> My program was crashing, so I tracked the issue back to a call made from
> sqlapi to the freeTDS SQLSetDescRec method. It seems that sqlapi and freetds
> disagree over the meaning of the nRecordNumber parameter, with sqlapi
> starting indexing at 1 and freetds starting at 0, with the end result that
> memory past the end of desc->records was being written to (and thus causing
> the crash).
>
> Looking at the MSDN ODBC reference
> http://msdn.microsoft.com/en-us/library/ms714675(VS.85).aspx it looks to me
> that nRecordNumber should start indexing at 1, with an index of 0 being
> reserved for the 'bookmark record', though I'm not sure what the bookmark
> record is....
>
> so I modified freeTDS to adjust the offset before accessing the
> desc->records array (very simple patch attached) and this fixed my problem.
>
> hopefully this is a real bug report / patch and is helpful to you,
>
> regards,
>
> Amir
>
> PS I'm using freeTDS version 0.64, but the patch is against current CVS
> which still appears to have the same problem
>

Thanks, patch is ok.

Applied to 0.64, 0.82 and CVS HEAD. You can find post release patch at
http://freetds.sourceforge.net/ (updated snapshot will be generated
this nigth).

Regards
Frediano




Archive powered by MHonArc 2.6.24.

Top of Page