mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +01:00
fixed bug causing false positives on CPE entries with a vendor or product descriptor that is two or less characters as part of fix for #229
Former-commit-id: b4c9c8bcb2b5f542933747067b516b9247443d96
This commit is contained in:
@@ -422,17 +422,6 @@ public class CPEAnalyzer implements Analyzer {
|
||||
* @return whether or not the EvidenceCollection contains the string
|
||||
*/
|
||||
private boolean collectionContainsString(EvidenceCollection ec, String text) {
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="This code fold contains an old version of the code, delete once more testing is done">
|
||||
// String[] splitText = text.split("[\\s_-]");
|
||||
//
|
||||
// for (String search : splitText) {
|
||||
// //final String search = text.replaceAll("[\\s_-]", "").toLowerCase();
|
||||
// if (ec.containsUsedString(search)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//</editor-fold>
|
||||
//TODO - likely need to change the split... not sure if this will work for CPE with special chars
|
||||
if (text == null) {
|
||||
return false;
|
||||
@@ -454,9 +443,16 @@ public class CPEAnalyzer implements Analyzer {
|
||||
list.add(word);
|
||||
}
|
||||
}
|
||||
if (tempWord != null && !list.isEmpty()) {
|
||||
final String tmp = list.get(list.size() - 1) + tempWord;
|
||||
list.add(tmp);
|
||||
if (tempWord != null) {
|
||||
if (!list.isEmpty()) {
|
||||
final String tmp = list.get(list.size() - 1) + tempWord;
|
||||
list.add(tmp);
|
||||
} else {
|
||||
list.add(tempWord);
|
||||
}
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
boolean contains = true;
|
||||
for (String word : list) {
|
||||
|
||||
Reference in New Issue
Block a user