airbus-seclab / bincat

Binary code static analyser, with IDA integration. Performs value and taint analysis, type reconstruction, use-after-free and double-free detection
1.69k stars 163 forks source link

Improper escape in NpkGen #112

Closed DarkaMaul closed 4 years ago

DarkaMaul commented 4 years ago

Hello,

While trying to run BinCAT on a binary with types information, the following exception occurred :

   raise error, v # invalid expression
sre_constants.error: nothing to repeat

It is coming from npkgen when a structure has a regex special character in its name (e.g. +,*):

# File "idabincat/npkgen.py", line 83, in get_header_data
search = r"(^\s*(?:typedef )?)\b%s\b" % s

Fixed line should be:

search = r"(^\s*(?:typedef )?)\b%s\b" % re.escape(s)

I can do a PR if needed/easier.

trou commented 4 years ago

Hello, thanks for the report, yes a PR is welcome :)