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

SYNERGY 512 SonarCloud vulnerabilities in Synergy-Core #6971

Merged

Conversation

abatyiev
Copy link
Contributor

No description provided.

* Fix all vulnerablilities from SonarCloud besides TLS
* Update ChangeLog
@abatyiev abatyiev force-pushed the SYNERGY-512-SonarCloud-vulnerabilities-in-Synergy-Core branch from 2d28932 to 732d21a Compare March 31, 2021 08:29
src/gui/src/QUtility.cpp Outdated Show resolved Hide resolved
src/lib/net/TCPListenSocket.cpp Outdated Show resolved Hide resolved
Comment on lines +1121 to +1132
if (std::find_if(data.begin(), data.end(),
[](const unsigned char& c) { return c < 32 || c > 126; }) != data.end()) {
const String hex_digits = "0123456789abcdef";
String tmp;
tmp.reserve(data.length() * 3);
std::for_each(data.begin(), data.end(), [hex_digits, &tmp](const unsigned char& c)
{
tmp += hex_digits[c >> 16];
tmp += hex_digits[c & 15];
tmp += ' ';
});
data = tmp;
Copy link
Contributor

Choose a reason for hiding this comment

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

This code looks ok but looks like it can be easily moved to separate function with one parameter to reduce the complexity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Beside of complexity this code also has logical errors(converting to hex going wrong). 1128 line contains byte offset of uchar but with value 16 instead of 4. I think, that even log changes can lead to problems, when you are not well familiar with projects, that's why I prefer to do my first changes with minimum of intervention. But if you insist - I'll move this part to new function and, also, can fix char conversion.

Copy link
Contributor

Choose a reason for hiding this comment

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

@abatyiev Could you please, create a new task in Jira for the problem with hex conversion.
We will change this code under the new task because it requires thorough investigation.
I will merge this code as is.

src/lib/platform/XWindowsClipboard.cpp Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Apr 5, 2021

@SerhiiGadzhilov SerhiiGadzhilov self-requested a review April 6, 2021 09:51
@SerhiiGadzhilov SerhiiGadzhilov merged commit ad1fd9c into master Apr 6, 2021
@SerhiiGadzhilov SerhiiGadzhilov deleted the SYNERGY-512-SonarCloud-vulnerabilities-in-Synergy-Core branch April 6, 2021 10:02
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.

None yet

2 participants