Dear community
We are currently assessing the performances of the C/C++ code analyzer.
On the very simple test code below, it reports only bug 1 while other analyzers like cppcheck found all excepted bug 5
Are we simply misusing the tool or is the detection performance really that bad?
Thanks
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
int main(void)
{
char *ptr;
char buffer[1];
*ptr=0; // Bug 1 (ptr is not initialized/allocated)
ptr=malloc(1);
strcpy(ptr,"1"); // Bug 2 (out of bounds due to \0)
free(ptr);
*ptr=0; // Bug 3 (ptr was freed)
buffer[1]='0'; // Bug 4 (out of bounds)
ptr=&buffer[1];
*ptr=0; // Bug 5 (out of bounds)
return 1;
}