MegaAntiCheat / client-backend

GNU General Public License v3.0
118 stars 25 forks source link

Launch options not recognized when using paths with %command% #113

Closed Ar4m1s closed 7 months ago

Ar4m1s commented 7 months ago

The launch option string "LD_PRELOAD=$LD_PRELOAD:/usr/lib32/libtcmalloc_minimal.so %command% -condebug -conclearlog -usercon -g15 -novid -nojoy" does not match because the regex does not include the characters / $ : = . even though the string contains the necessary launch options. It is probably a simple fix. I made it work, while not properly tested that just prepending "/$:=." to the regex fixes the issue.

let launch_options_regex =
            Regex::new(r#"\t{6}"LaunchOptions"\t{2}"([(/$:=\.\-\w\%\!\@\^\&)\s]*)""#)
                .expect("Constructing LaunchOptions regex");
Ar4m1s commented 7 months ago

Alternatively simplify like this:

let launch_options_regex = Regex::new(r#"\t{6}"LaunchOptions"\t{2}"([^"]*)""#).unwrap();

Which is less strict but catches a lot of other cases and is far easier to read and understand.

Bash-09 commented 7 months ago

Done in #115