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

Uninitialized pointer in bot.cpp #129

Closed
tarwyn opened this issue Mar 5, 2014 · 0 comments
Closed

Uninitialized pointer in bot.cpp #129

tarwyn opened this issue Mar 5, 2014 · 0 comments

Comments

@tarwyn
Copy link

tarwyn commented Mar 5, 2014

Code at line 14970 in bot.cpp looks as follows:

            Bot* targetedBot;

            if(c->GetTarget() != nullptr) {
                if (c->GetTarget()->IsBot() && (c->GetTarget()->CastToBot()->GetBotOwner() == c))
                    targetedBot = c->GetTarget()->CastToBot();
                else
                    c->Message(13, "You must target a bot that you own.");

                if(targetedBot) {

It's possible that the targetedBot pointer is used uninitialized by the if() statement on line 14978, which can subsequently lead to a crash.

To fix, I suggest line 14970 to be changed to either:

            Bot* targetedBot = nullptr;

or

            Bot* targetedBot = 0;
@mackal mackal closed this as completed in 0e8f62b Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant