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

Fix #766: Handle relative report paths with backticks outside basedir. #780

Merged
merged 1 commit into from
Feb 20, 2016

Conversation

mjdetullio
Copy link
Contributor

It was possible to have an NPE when normalizing backticks on relative
paths if the backticks moved the directory too far back. This change
will handle invalid normalization of relative paths.

Normalization is reattempted against the absolute path, and if it is
still invalid then it is not given to the directory scanner, which does
not accept null elements.

…ks outside basedir.

It was possible to have an NPE when normalizing backticks on relative
paths if the backticks moved the directory too far back.  This change
will handle invalid normalization of relative paths.

Normalization is reattempted against the absolute path, and if it is
still invalid then it is not given to the directory scanner, which does
not accept null elements.
String normalizedPath = FilenameUtils.normalize(reportPath);
if (normalizedPath != null && new File(normalizedPath).isAbsolute()) {
includes.add(normalizedPath);
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mjdetullio I'm not a fan of continue in loops. Think if / else if / else would be the same ....

@guwirth guwirth added this to the M 0.9.5 milestone Feb 20, 2016
@guwirth
Copy link
Collaborator

guwirth commented Feb 20, 2016

fix #766 together with #775

guwirth added a commit that referenced this pull request Feb 20, 2016
Fix #766: Handle relative report paths with backticks outside basedir.
@guwirth guwirth merged commit 7395724 into SonarOpenCommunity:master Feb 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants