Skip to content

Commit

Permalink
Small amendment and one more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelmold committed Nov 1, 2024
1 parent 9a8ef38 commit afc1515
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 1 addition & 3 deletions util/cpeutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions util/cpeutils_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit afc1515

Please sign in to comment.