[Asterisk-Dev] [RFC] strncpy -> ast_copy_string

Brian West brian.west at mac.com
Tue May 3 13:34:40 MST 2005


ast_copy_string is BROKEN!!!!!!!!

chan_sip.c L3297

ast_copy_string(hostname, h, hn);  <-- broken

ast_copy_string(hostname, h, hn+1); <-- this works!


I don't think this was the desired result eh?

/b

On May 3, 2005, at 2:11 PM, James Golovich wrote:

> I haven't been following this too closely, but I know about
> ast_strlen_zero since I did that.  Most uses of strlen in asterisk  
> were to
> check if a string was or wasn't length 0, but there still are a ton of
> uses that really need to know the length.
>
> James
>
> On Tue, 3 May 2005, Brian West wrote:
>
>
>> I also have another question.. why didn't we just override strncpy
>> and strlen with our own functions to call them how we want.. instead
>> of comign up with ast_strlen_zero and ast_string_copy?
>>
>> /b
>>
>> On May 2, 2005, at 8:13 PM, Jeffrey C. Ollie wrote:
>>
>>
>>> On Mon, 2005-05-02 at 16:46 -0700, Luigi Rizzo wrote:
>>>
>>>
>>>>
>>>> i am fine with that, but i am unhappy about the mixture, in the  
>>>> code,
>>>> of symbolic constants and magic numbers for apparently similar
>>>> fields.
>>>>
>>>> If you support variable size strings you pretty much know that
>>>> truncations may only occur when you put strings into protocol
>>>> messages;
>>>> with the current approach they might happen somewhere in the
>>>> middle of the chain, and it may be hard to tell where.
>>>>
>>>>
>>>
>>> This probably has to do with the fact that Asterisk is an active
>>> project
>>> with a lot of contributors.  You're right that this could lead to
>>> problems.  Someone with some interest needs to sit down with the  
>>> code
>>> and come up with a patch. (hint, hint)
>>>
>>> Jeff
>>>
>>> _______________________________________________
>>> Asterisk-Dev mailing list
>>> Asterisk-Dev at lists.digium.com
>>> http://lists.digium.com/mailman/listinfo/asterisk-dev
>>> To UNSUBSCRIBE or update options visit:
>>>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>>>
>>
>> _______________________________________________
>> Asterisk-Dev mailing list
>> Asterisk-Dev at lists.digium.com
>> http://lists.digium.com/mailman/listinfo/asterisk-dev
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>>
>>
>
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>




More information about the asterisk-dev mailing list