diff --git a/qa/coccinelle/banned-functions.cocci b/qa/coccinelle/banned-functions.cocci new file mode 100644 index 0000000000..77da2452ee --- /dev/null +++ b/qa/coccinelle/banned-functions.cocci @@ -0,0 +1,17 @@ +@banned@ +identifier func ~= "^\(sprintf\|strcat\|strcpy\)$"; +position p1; +@@ + +<+... +func(...)@p1 +...+> + +@ script:python @ +p1 << banned.p1; +func << banned.func; +@@ + +print "Banned function %s() used at %s:%s" % (func, p1[0].file, p1[0].line) +import sys +sys.exit(1)