Skip to Content.
Sympa Menu

freetds - Re: dberrhandler() and dbmsghandler()

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: Re: dberrhandler() and dbmsghandler()
  • Date: Fri, 6 Sep 2002 17:11:35 -0400

> From: Steven J. Backus [mailto:backus AT math.utah.edu]
> Sent: September 6, 2002 3:00 PM
>
> > If you will post a simple test program evincing the problem
> when linked with
> > the most recent snapshot, I will look at it. The current code in
> > src/tds/token.c::tds_process_msg() looks clean, but maybe under some
> > circumstances it fetches a corrupted servername?
>
> Using the freetds in:
>
> ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/freetds-current.tgz
>
[test code omitted]

> It crashes, here's the bt:
>
> (gdb) bt
> #0 0xdfb7d489 in strlen () from /usr/lib/libc.so.1
...
> #6 0x804a363 in dbsqlexec (dbproc=0x8067df0) at dblib.c:617
> #7 0x804a39f in dbuse (dbproc=0x8067df0, dbname=0x8058fdc "ged")
> at dblib.c:627
> #8 0x8049699 in main (argc=1, argv=0x804770c) at testtds.c:39

Steve,

Patch attached.

The problem I found is that dblib calls your handler with the "char
*procname" set to NULL. Microsoft's documentation at any rate says "If the
message was not generated by a stored procedure, procname is set to a length
of 0". So I allocate a byte, set it to null, and return its address.

If I'd invented C, strlen(NULL) would be zero. But Dennis never asked my
opinion.

Thanks for the PR, Steve. You just made 0.60 one better.

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.




Attachment: token.diff
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page