banned-functions.cocci 331 B

12345678910111213141516
  1. @banned@
  2. identifier i;
  3. position p1;
  4. @@
  5. \(strtok@i\|sprintf@i\|strcat@i\|strcpy@i\|strncpy@i\|strncat@i\|strchrnul@i\|atoi@i\|rand@i\|rand_r@i\|index@i\|rindex@i\|bzero@i\)(...)@p1
  6. @script:python@
  7. p1 << banned.p1;
  8. i << banned.i;
  9. @@
  10. print("Banned function '%s' used at %s:%s" % (i, p1[0].file, p1[0].line))
  11. import sys
  12. sys.exit(1)