Skip to Content.
Sympa Menu

freetds - dbconvert bugs

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: dbconvert bugs
  • Date: Tue, 9 Jul 2002 11:02:41 -0400


All,

The code:

DBINT dbconvert(DBPROCESS *dbproc,
int srctype,
BYTE *src,
DBINT srclen,
int desttype,
BYTE *dest,
DBINT destlen)
{
TDSSOCKET *tds = NULL;

if (dbproc) {
tds = (TDSSOCKET *) dbproc->tds_socket;
}

if (srclen==-1) srclen = strlen((char *)src);
return tds_convert(g_tds_context->locale, srctype, (TDS_CHAR *)src,
srclen, desttype, (TDS_CHAR *)dest, destlen);
}

Bug 1: for fixed-length datatypes, srclen should be ignored, and in any
case we shouldn't attempt a strlen on anything not a string. Test should
be:

if (srclen==-1) {
switch(srctype) {
case SYBCHAR:
case SYBVARCHAR:
/* case SYBTEXT: ?? */
srclen = strlen((char *)src);
break;
default:
break;
}
}

Bug 2: I don't see what tds is doing for us. Perhaps the computer is
curious?

Bug 3: Because tds_convert has no dbproc, it can't call the proc's error
handler. There are many many places it should call the error handler:
buffer overflows, null destination pointers, inconvertibility. This touches
on Frediano's #578095, and is too big a problem, unfortunately, to deal with
in 0.60.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page