diff --git a/util/cpeutils.c b/util/cpeutils.c index 2ef636ec..24d53634 100644 --- a/util/cpeutils.c +++ b/util/cpeutils.c @@ -801,9 +801,7 @@ get_fs_component (const char *fs_cpe, int index) { for (int i = 0; *c != '\0' && i < index; c++) { - if (*c == ':' && c == fs_cpe) - i++; - else if (*c == ':' && !escaped) + if (*c == ':' && !escaped) i++; else if (*c == '\\' && !escaped) escaped = TRUE; diff --git a/util/cpeutils_tests.c b/util/cpeutils_tests.c index 4f42e55c..648c384b 100644 --- a/util/cpeutils_tests.c +++ b/util/cpeutils_tests.c @@ -230,6 +230,15 @@ Ensure (cpeutils, fs_cpe_to_uri_cpe) "cpe:/a:hp:insight_diagnostics:7.4.0.1570:-:~~online~win%3A2003~x64~")); g_free (uri_cpe); + fs_cpe = + "cpe:2.3:a:hp:insight_diagnostics:7.4.0.1570:-:*:*:online:win\\:\\:2003:x64:*"; + uri_cpe = fs_cpe_to_uri_cpe (fs_cpe); + assert_that ( + uri_cpe, + is_equal_to_string ( + "cpe:/a:hp:insight_diagnostics:7.4.0.1570:-:~~online~win%3A%3A2003~x64~")); + g_free (uri_cpe); + fs_cpe = "cpe:2.3:a:hp:insight_diagnostics:7.4.0.1570:-:*:*:online:" "win2003\\\\:x64:*"; uri_cpe = fs_cpe_to_uri_cpe (fs_cpe);