The variable parameters of a variadic function, that is, those that correspond with the position of the ellipsis, are interpreted by the va_arg()
macro. The va_arg()
macro is used to extract the next argument from an initialized argument list within the body of a variadic function implementation. The size of each parameter is determined by the specified type. If the type is inconsistent with the corresponding argument, the behavior is undefined and may result in misinterpreted data or an alignment error. (See guideline rule EXP36-C. Do not convert pointers into more strictly aligned pointer types.)
...
Search for vulnerabilities resulting from the violation of this recommendation on the CERT website.
Bibliography
Related Guidelines
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.5.2.2, "Function calls," and Section 7.15, "Variable arguments"
\[[ Wiki Markup
ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] TR 24772 "IHN Type system" and "OTR Subprogram Signature Mismatch" \[[MISRA 2004|AA. Bibliography#MISRA 04]\] Rule
MISRA Rule 16.1
Bibliography
...