Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
int function(int,int,int);
...

function(1,2);
...
int func(int one, int two, int three){
  printf("%d %d %d", one, two, three);
  return 1;
}

Non-Compliant Code Example 1

The following example is based on rule MEM02-A. The header file{{stdlib.h}} contains the function prototype for malloc(). Failing to include stdlib.h causes malloc() to be implicitly defined and the compiler makes the assumption that malloc() has a return type of int.

Code Block
bgColor#FFCCCC

char *p = malloc(10);

Compliant Solution 2

Code Block
bgColor#ccccff

#include <stdlib.h>
...
char *p = malloc(10);

Examples of vulnerabilities with CVE entry number

...