weggli-rs / weggli

weggli is a fast and robust semantic search tool for C and C++ codebases. It is designed to help security researchers identify interesting functionality in large codebases.
Apache License 2.0
2.32k stars 127 forks source link

Function variable position independence #79

Open backahasten opened 1 year ago

backahasten commented 1 year ago

When establishing rules, the position of function parameters will affect weggli's search, for example:

int bad(int limit,char *buf) 
{
    char buf[BUFSIZE];

    for (int i = 0; i < limit; i++) {
        buf[i] = "A";
    }
}

Can be found by

_ $fn(_ $limit ,_*$buf) {
    for (_; $i<$limit; _) {
        $buf[$i]=_;
    }
}

but

_ $fn(_*$buf,_ $limit ) {
    for (_; $i<$limit; _) {
        $buf[$i]=_;
    }
}

Can not find. Does weggli provide an option to ignore the position of function parameters