mirror of https://github.com/OISF/suricata
coccinelle: add test for banned function
The added semantic patch will trigger an error if banned functions are used.remotes/origin/master-1.1.x
parent
9beebf621a
commit
7f1a0d1ed1
@ -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)
|
||||||
Loading…
Reference in New Issue