Skip to Content.
Sympa Menu

freetds - Re: 0.60 + PHP + MSSQL2K segfault -- depends on the query (??)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: 0.60 + PHP + MSSQL2K segfault -- depends on the query (??)
  • Date: 16 Nov 2002 01:20:43 +0100


>
> 991105 thies AT thieso.net */
>
> dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset),
> res_length,SYBCHAR,res_buf,-1);
>
> Converting binary -> char PHP allocate only length+1 bytes of binary but
> conversion binary -> char require 2*length bytes (plus terminator), do
> it's a buffer overflow.
> So, or PHP is wrong and should allocate more space or FreeTDS dblib is
> wrong and conversion binary -> char should just do a memcpy instead of
> converting to hexadecimal...
>
> freddy77
>

>From Sybase docs:

A conversion to or from the datatypes SYBBINARY and SYBIMAGE is a
straight bit-copy, except when the conversion involves SYBCHAR or
SYBTEXT. When converting SYBCHAR or SYBTEXT data to SYBBINARY or
SYBIMAGE, DBCONVERT interprets the SYBCHAR or SYBTEXT string as
hexadecimal, whether or not the string contains a leading "0x". When
converting SYBBINARY or SYBIMAGE data to SYBCHAR or SYBTEXT, dbconvert
creates a hexadecimal string without a leading "0x".

So, is definitely a PHP bug !

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page