change log for rtems (2011-03-15)

Ralf Corsepius ralf.corsepius at rtems.org
Tue Mar 15 15:54:34 UTC 2011


On 03/15/2011 04:38 PM, Sebastian Huber wrote:
> On 03/15/2011 04:27 PM, Ralf Corsepius wrote:
>> On 03/15/2011 04:10 PM, rtems-vc at rtems.org wrote:

>> argv is defined as being 0 terminated
>> =>  using strnlen is wrong.
>> =>  Coverity is wrong
>
> Yes, the strlen() to strnlen() change is nonsense.  Coverity doesn't like
> strcpy() in general.  It is happy if you use strncpy() or memcpy() instead so
> it can check the length parameter.
Ouch, are they really that stupid?

Using strnlen makes sense when a string has a maximum length, but when a 
string doesn't have one, it doesn't make much sense.

>  Since we know the capacity of "string" we
> could pass a worst case length,
I would not do so, because this would not help detecting memory leaks 
either, but only shift the leak around.

Or differently: In cases like these, it's the callers responsibility to 
make sure the string is 0 terminated.

In case like these, this usually is the compiler.

> but this makes all more complicated for
> nothing.
Exactly.




More information about the vc mailing list