[Click] Can/does cp_va_(k)parse check size of its arguments?

Eddie Kohler kohler at cs.ucla.edu
Tue May 6 13:06:54 EDT 2008


Unfortunately, there is no way in C/C++ varargs functions to reliably 
check sizes, and cp_va_kparse does not even try.  The best solution 
would be some sort of templatized version of cp_va_kparse, but that is 
not going to happen any time soon.

Eddie


Bart Braem wrote:
> Hello,
> 
> One of our students encountered a nasty bug where he parsed an element  
> configuration into variables that were too small: he used a cpUnsigned  
> argument to put data in a uint8_t. The variables next to that uint8_t  
> where overwritten and some bytes were mysteriously changed.
> At first sight cp_va_kparse does check for this size problem but it  
> does not seem to work, or am I mistaken?
> 
> Regards,
> Bart


More information about the click mailing list