[sword-devel] PATCH for crashes with ciphering code

Troy A. Griffitts scribe at crosswire.org
Mon Dec 4 06:58:40 MST 2006


Hi Martin,
    You cannot take out the line you have taken out without changing the 
logic of the code.  Not having written the code, I cannot confirm that 
you have not broken anything.  Please note that SWBuf::setSize will be 
sure the data buffer can handle at least 'size' number of byte.  Since 
the code is modifying the raw data buffer in SWBuf, size needs to be 
reset to the actual size of the buffer.  strncpy will copy NO MORE than 
size, but might copy less.

    -Troy.

Martin Gruner wrote:
> Hi Troy.
>
> Thanks for taking notice of my patch.
>
> The strlen should not pose a problem, because I removed one that was there but 
> seemed superfluous:
>
> -inBuf.setSize(strlen(inBuf.c_str()));
>
> So we still have only one strlen. Nothing should be slower.
>
> God bless.
>
> Martin
>
> Am Montag, 4. Dezember 2006 05:43 schrieb Troy A. Griffitts:
>   
>> Thanks Daniel,
>> 	If you take this on, please note:
>>
>> Do not include this:
>>
>> +		cacheBuf[0]='\0'; //just in case len==0
>>
>>
>> Please see if the added strlen is much of a speed hit.  This code should
>> probably be changed to use SWBuf, which keeps track of len and doesn't
>> need to do strlen to return size.  I believe it was written by a
>> volunteer long before SWBuf existed.  Thanks for any help.
>>
>> 	-Troy.
>>
>> PS.  My apologies for being away.  It's the end of the semester in about
>> 10 days and I'm totally behind.  Hope to resurface again after.
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>>     
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
>   




More information about the sword-devel mailing list