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

If load config size is larger than reported, overwrite #1050

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yardenshafir
Copy link
Contributor

No description provided.

@yardenshafir yardenshafir requested a review from woodruffw January 6, 2023 15:43
@yardenshafir yardenshafir force-pushed the yarden/use-correct-load-config-size branch from bc1649f to fa57793 Compare January 6, 2023 16:03
checksec.cpp Outdated
std::cerr << "Warn: load config larger than reported by data directory entry,"
<< " overwriting"
<< "\n";
memcpy(&loadConfig, loadConfigData.data(), loadConfig.Size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need a bounds check on loadConfigData.data() + loadConfig.Size, right?

LGTM otherwise!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so, since the total data size is loadConfig.Size, we just overwrite the data we already copies earlier, not add to it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant for the PE container itself -- I could be wrong, but I think someone could modify a PE to set the load config's size to a size larger than the PE itself, meaning that loadConfigData.data() + loadConfig.Size would point past the end of the PE in memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what you mean. Yeah, I'll add that check!

@yardenshafir yardenshafir force-pushed the yarden/use-correct-load-config-size branch 3 times, most recently from 85c33c0 to 1a5a52b Compare January 6, 2023 16:42
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

Successfully merging this pull request may close these issues.

2 participants