A function is called with arguments despite having an empty parameter list. This may indicate -that the incorrect function is being called, or that the author misunderstood the function.
- -In C, a function declared with an empty parameter list () is considered to have an unknown
-parameter list, and therefore can be called with any set of arguments. To declare a function
-which takes no arguments, you must use (void) as the parameter list in any forward declarations.
-In C++, either style of declaration indicates that the function accepts no arguments.
Call the function without arguments, or call a different function that expects the arguments -being passed.
- -A function is called with at least one argument whose type is incompatible with the type of + the corresponding parameter of the function being called. This may cause the called function + to behave unpredictably.
+ +This may indicate that an incorrect function is being called, or that the + signature (parameter list and parameter types) of the called function + is not known to the author.
+ +Call the function with the proper argument types. In some cases, it may + suffice to provide an explicit cast of an argument to the desired (parameter) type.
+ +A function is called with fewer arguments than there are parameters of the function.
+ +This may indicate that an incorrect function is being called, or that the signature + (parameter list) of the called function is not known to the author.
+ +In C, function calls generally need to provide the same number of arguments as there are + arguments to the function. (Variadic functions can accept additional arguments.) Providing + fewer arguments than there are parameters is extremely dangerous, as the called function + will nevertheless try to obtain the missing arguments' values, either from the stack + or from machine registers. As a result, the function may behave unpredictably.
+ +If the called function modifies a parameter corresponding to a missing argument, it + may alter the state of the program upon its return. An attacker could use this to, + for example, alter the control flow of the program to access forbidden resources.
+ +Call the function with the correct number of arguments.
+ +A function is called with more arguments than there are parameters of the function.
+ +This may indicate that an incorrect function is being called, or that the signature + (parameter list) of the called function is not known to the author.
+ +In C, function calls generally need to provide the same number of arguments as there are + arguments to the function. (Variadic functions can accept additional arguments.) Providing + more arguments than there are parameters incurs an unneeded computational overhead, both + in terms of time and of additional stack space.
+ +Call the function with the correct number of arguments.
+ +