Skip to Content.
Sympa Menu

freetds - Re: [freetds] [PATCH] Problem with VARCHAR in sybase.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [PATCH] Problem with VARCHAR in sybase.
  • Date: Mon, 7 Jul 2008 10:01:37 -0400

Eddy Pronk wrote:
> > If datafmt->maxlength represents the size of an
> > allocated buffer, increasing it without reallocating will write the
> > NULL to unallocated memory, with predictable unpredictable [sic]
> > results.
>
> In dbd_freetds.c inside libdbi the allocation is done. I allocated 1byte
>
> extra as well, so that is fine.
>
> I've seen your recent changes. I would expect with your changes if I
> remove the ++datafmt->maxlength; it would still work but it breaks.

No, I made some corrections, but the fundemental behavior was right: you
must provide room in the destination buffer for the terminating NULL. If
you don't, ct_fetch will fail.

I fixed what ct_fetch does before it fails. Previously, it wouldn't copy
anything if the destination buffer was too small. Now it copies as much
as fits.

> Are you willing to look at libdbi?

I'm not really eager to do that. I'm very willing to help you get it
right, though. It sounds like the change you made is correct.

> do you think it is possible to run the unittests on Solaris with
> the Sybase libraries?

It is meant to be possible and shouldn't be too hard. One of the things
I'd like to do is change the unit test machinery to make it easy to link
them to other libraries instead. That would make inconsistent behavior
easier to find.

Regards,

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page