siginit.cocci 473 B

123456789101112131415161718192021222324252627
  1. @siginit@
  2. identifier func =~ "Detect.*Setup";
  3. expression E1;
  4. position p1;
  5. identifier de_ctx, s, str, error;
  6. type DetectEngineCtx, Signature;
  7. @@
  8. func(DetectEngineCtx *de_ctx, Signature *s, char *str) {
  9. ...
  10. SigMatchAppendSMToList(s, ...)@p1;
  11. ...
  12. if (s->alproto != E1 && ...) {
  13. ...
  14. goto error;
  15. }
  16. ...
  17. }
  18. @script:python@
  19. p1 << siginit.p1;
  20. @@
  21. print("SigMatch added at %s:%s but error handling can cause it to be freed later." % (p1[0].file, p1[0].line))
  22. import sys
  23. sys.exit(1)