Hi,
Below code will be checked as null pointer dereference. But with the function call replaced with a function pointer, no error message will be reported. Seems cppcheck will not recognize a function pointer as a function.
char * func(){return 0;} int main() { char * (*f_p)(); f_p = func; char * p = func(); *p = 'a'; return 0; }
Nothing reported.
char * func(){return 0;} int main() { char * (*f_p)(); f_p = func; char * p = f_p(); *p = 'a'; return 0; }
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14950
Log in to post a comment.
Hi,
Below code will be checked as null pointer dereference. But with the function call replaced with a function pointer, no error message will be reported. Seems cppcheck will not recognize a function pointer as a function.
Nothing reported.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14950