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

Fixes ssecurityplain #440

Merged
merged 2 commits into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion common/rfb/SSecurityPlain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,20 @@ bool SSecurityPlain::processMsg(SConnection* sc)
if (state == 0) {
if (!is->checkNoWait(8))
return false;

ulen = is->readU32();
if (ulen > MaxSaneUsernameLength)
throw AuthFailureException("Too long username");

plen = is->readU32();
if (plen > MaxSanePasswordLength)
throw AuthFailureException("Too long password");

state = 1;
}

if (state == 1) {
if (is->checkNoWait(ulen + plen + 2))
if (!is->checkNoWait(ulen + plen))
return false;
state = 2;
pw = new char[plen + 1];
Expand Down
3 changes: 3 additions & 0 deletions common/rfb/SSecurityPlain.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ namespace rfb {
PasswordValidator* valid;
unsigned int ulen, plen, state;
CharArray username;

static const unsigned int MaxSaneUsernameLength = 1024;
static const unsigned int MaxSanePasswordLength = 1024;
};

}
Expand Down