mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-13 23:33:37 +01:00
Limit split to fix #503
This commit is contained in:
@@ -73,7 +73,7 @@ public class VulnerableSoftware extends IndexEntry implements Serializable, Comp
|
||||
public void parseName(String cpeName) throws UnsupportedEncodingException {
|
||||
this.name = cpeName;
|
||||
if (cpeName != null && cpeName.length() > 7) {
|
||||
final String[] data = cpeName.substring(7).split(":");
|
||||
final String[] data = cpeName.substring(7).split(":", 4);
|
||||
if (data.length >= 1) {
|
||||
this.setVendor(urlDecode(data[0]));
|
||||
}
|
||||
|
||||
@@ -78,4 +78,14 @@ public class VulnerableSoftwareTest extends BaseTest {
|
||||
result = instance.compareTo(vs);
|
||||
assertEquals(expResult, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseCPE() {
|
||||
VulnerableSoftware vs = new VulnerableSoftware();
|
||||
/* Version for test taken from CVE-2008-2079 */
|
||||
vs.setCpe("cpe:/a:mysql:mysql:5.0.0:alpha");
|
||||
assertEquals("mysql", vs.getVendor());
|
||||
assertEquals("mysql", vs.getProduct());
|
||||
assertEquals("5.0.0:alpha", vs.getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user