Re: [Sqlrelay-discussion] Issue with Microsoft SQL/FreeTDS and SQLRelay
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2012-05-01 14:01:56
|
Stephen,
I discovered the root of the problem. In the rudiments library, in the
src/charstring.cpp file, around line 842, there is a method "copy" like:
char *charstring::copy(char *dest, const char *source, size_t size) {
return (char *)rawbuffer::copy((void *)dest,(const void *)source,size);
}
which should be:
char *charstring::copy(char *dest, const char *source, size_t size) {
return strncpy(dest,source,size);
}
I had changed it to get around an issue on windows but the change is not
equivalent, and actually somewhat foolish. strncpy will stop when it
finds a NULL terminator, but rawbuffer::copy will copy "size" bytes even
if the string isn't that long, which can cause a segfault. I'm
surprised that I didn't run into it during my testing.
I just made that change in the last release of rudiments, which is why
it just popped up now.
I'll make an updated release with a fix later today but that's a quick fix.
Dave
dav...@fi...
On 04/30/2012 02:15 PM, David Muse wrote:
> Thanks for tracking that down. I'll do some tests and see if I can
> come up with a solid fix.
>
> Dave
> dav...@fi...
>
> On 04/30/2012 01:03 PM, Stephen barclay wrote:
>> David,
>>
>> Sorry for the delay, I just got back from vacation..
>>
>> I tracked the issue down to what appears to be a non terminated
>> string...
>>
>> In listenercomm.cpp when the charstring::copy is called, the data
>> overflows and
>> corrupts the shared memory segment.
>>
>>
>>
>>
>> My temp fix to get things going was to set all of my ConnectionID's
>> to <= 4 bytes
>>
>> ie CEA, CEAS, TEST, PROD, WORK, DEMO and change the following value
>> in /src/common/defines.h
>>
>> #define MAXCONNECTIONIDLEN *4 *(originally 1024)
>>
>>
>> This fixed the issue and I am up and running..
>>
>> Hopefully this might give you some insight into what the
>> issue might be..
>>
>>
>> --
>>
>> Respectfully,
>>
>>
>> *Stephen Barclay*
>> Partner, Telecom Engineer
>> www.call-em-all.com
>> Direct: 972.893.3119
>>
|