[PHP4BETA] php4+freetds, off-by-1 truncation

rasmus at php.net rasmus at php.net
Fri Dec 3 20:19:26 EST 1999


> Ok, this one is fixed and in CVS.  Or you can patch your local copy
> thusly:
> 
> In src/tds/convert.c function tds_convert_any() change
> 
>    return(strlen(dest));
> 
> to 
> 
>    return (strlen(dest)+1);
> 
> What happens is PHP uses length binding, which for strings should include
> the null as well as the characters in the string.  So, PHP cuts off what
> it thinks in the NULL but is actually the last character.  sqsh and
> DBD::Sybase don't seem to rely on length binding and were uneffected by
> this bug.

Hrm, doesn't this mean that DBD::Sybase and sqsh are not 8-bit clean then?

-Rasmus




More information about the FreeTDS mailing list