On Sep 18, 2014, at 4:31 PM, jahanian <[email protected]> wrote:

>> 
>> I am not sure what you mean. memcpy does not do any checking for overflow. 
>> You may do the checking for overflow before calling
>> memcpy yourself (essentially do what __builtin_memcpy_chk does).
>> 
>> But it's detectable at compile time, right? Consider this, slightly changed 
>> from your tests:
>> 
>>   static char buf[10];
>>   memcpy(&buf[6], in, 5);
>> 
>> Is there any reason this shouldn't say "memcpy will always overflow 
>> destination buffer”?
> 
> 
> On the surface there is no reason. But manage does not disallow this and 
> there will be applications which probably take advantage of this relaxation.

Btw, on second thought, this might be a worthwhile feature for those who do not 
redefine memcpy to their __builtin_memcpy_chk siblings (provided it is
placed under its own security warning flag). It might be worth a bugzilla 
report.

- Thanks, Fariborz

> 
> - fariborz
> 
> 
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to