Skip to Content.
Sympa Menu

freetds - Re: MSSQL7.0 from freetds 0.45

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: tetherow AT nol.org
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: MSSQL7.0 from freetds 0.45
  • Date: Fri, 25 Jun 1999 18:10:24 -0500 (CDT)


On 25 Jun, Brian Bruns wrote:
> Ugh, I thought I had gotten rid of those! (There were a bunch of buffer
> overruns, and I thought I got them all...) Good to know anyway.
>
> Actually (I just peeked at the code) and set_library is doing a strncpy
> (which is correct). I am seeing a problem with the number place there by
> tds_put_buf, which is that the source size is used even if it exceeds the
> destination size (it should be the lesser of the two).
>
> Here is a replacement for tds_put_buf that should work:
>
> int tds_put_buf(TDSSOCKET *tds, unsigned char *buf, int dsize, int ssize)
> {
> char *tempbuf;
> int cpsize;
>
> tempbuf = (char *) malloc(dsize+1);
> memset(tempbuf,'\0',dsize);
> cpsize = ssize > dsize ? dsize : ssize;
> memcpy(tempbuf,buf, cpsize);
> tds_put_n(tds,tempbuf,dsize);
> free(tempbuf);
> tds_put_byte(tds,cpsize);
> }

That fixed it.

------------------------------------------------------------------------
Sam Tetherow tetherow AT nol.org
Director of Development
Nebrask@ Online http://www.nol.org/





Archive powered by MHonArc 2.6.24.

Top of Page