Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in ServiceArgumentParser via ServiceMain #8310

Open
sinclairjw opened this issue Apr 17, 2024 · 0 comments
Open

Crash in ServiceArgumentParser via ServiceMain #8310

sinclairjw opened this issue Apr 17, 2024 · 0 comments

Comments

@sinclairjw
Copy link

Bug report

What operating system and version are you using?

Windows Server 2012 R2 Standard

What version of osquery are you using?

5.10.2

What steps did you take to reproduce the issue?

No reproduction steps but crash occurs in https://github.com/osquery/osquery/blob/master/osquery/main/windows/main.cpp in the following code in the ServiceArgumentParser constructor:-

      if (arg == nullptr) {
        cleanArgs();
        ::LocalFree(wargv);
        break;
      }
      args_.push_back(arg);
    }
    owns_argv_ptrs_ = true;
    **::LocalFree(wargv);**

Should the call:-

LPSTR arg = toMBString(wargv[i]);

return nullptr the variable wargv is freed twice, hence the crash on the double-free.

What did you expect to see?

No crash should toMBString fail.

What did you see instead?

Crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants