mirror of https://github.com/OISF/suricata
coccinelle: fix problem with coccinelle 1.0rc21
coccinelle 1.0rc21 has a problem with regular expression handling. This result in a Fatal Error when test system detects an coding error. This patch fixes the problem by using a simple blob inside semantic patch instead of using a regular expression to define the function. It also fixes add an optimization on matching suppressing a useless <.. ..> construction. Fixes have been suggested by Julia Lawall.pull/1018/merge
parent
0ac94ef777
commit
d7982fae8c
@ -1,17 +1,15 @@
|
|||||||
@banned@
|
@banned@
|
||||||
identifier func =~ "^(sprintf|strcat|strcpy|strncpy|strncat|strndup|strchrdup)$";
|
identifier i;
|
||||||
position p1;
|
position p1;
|
||||||
@@
|
@@
|
||||||
|
|
||||||
<+...
|
\(sprintf@i\|strcat@i\|strcpy@i\|strncpy@i\|strncat@i\|strndup@i\|strchrdup@i\)(...)@p1
|
||||||
func(...)@p1
|
|
||||||
...+>
|
|
||||||
|
|
||||||
@ script:python @
|
@script:python@
|
||||||
p1 << banned.p1;
|
p1 << banned.p1;
|
||||||
func << banned.func;
|
i << banned.i;
|
||||||
@@
|
@@
|
||||||
|
|
||||||
print "Banned function %s() used at %s:%s" % (func, p1[0].file, p1[0].line)
|
print("Banned function '%s' used at %s:%s" % (i, p1[0].file, p1[0].line))
|
||||||
import sys
|
import sys
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
Loading…
Reference in New Issue