stevespringett / CPE-Parser

A utility for validating and parsing Common Platform Enumeration (CPE) v2.2 and v2.3 as originally defined by MITRE and maintained by NIST

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert.wellFormedToFS issue

serkanozkanssc opened this issue · comments

When a field in a CPE contains a trailing . character, parsing the CPE and converting it back to string generates a result different from the original cpe string.
For example

String cpe = "cpe:2.3:a:bookly_project:bookly:3.4.:*:*:*:*:wordpress:*:*";
Cpe parsedCpe = CpeParser.parse(cpe);
System.out.println(parsedCpe.toCpe23FS());

Outputs

cpe:2.3:a:bookly_project:bookly:3.4\.:*:*:*:*:wordpress:*:*

Probably an edge case but there are still CPEs with this format in NVD (although probably deprecated).