Closed TomMD closed 3 years ago
it's a good issue -- you can only bind a variable name to a token, not to a token sequence like a->b->x, which is what you want here. i don't see a better solution that what you tried here either.
by the way: the -- prefix (as in --cpp) passes arguments to an optional backend, which isn't used here which means that the argument is ignored. (use -cpp to enable preprocessing instead)
Motivated by a use of
memset() ; free()
in linux-pam, I made a cobra pattern to detect these instances (which should use memset_s):Sadly this does not work. The
x
identifier isn't usually anx
at all but something likea->b->x
ora->b->c->x
etc. I've worked around the issue by allowing more false positives:That is, we now will complain about
memset(a->x, 0, N); free(b->x);
. Is there a more general match I should be using thanident
which makes something akin to the first attempt work?