Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove the insertion of deprecated-by-id from XML CPE feed files #2319

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions src/manage_sql_secinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ static int
insert_scap_cpe (inserts_t *inserts, element_t cpe_item, element_t item_metadata,
int modification_time)
{
gchar *name, *status, *deprecated, *nvd_id;
gchar *name, *status, *nvd_id;
gchar *quoted_name, *quoted_title, *quoted_status, *quoted_nvd_id;
element_t title;
int first;
Expand All @@ -2103,27 +2103,12 @@ insert_scap_cpe (inserts_t *inserts, element_t cpe_item, element_t item_metadata
return -1;
}

deprecated = element_attribute (item_metadata,
"deprecated-by-nvd-id");
if (deprecated
&& (g_regex_match_simple ("^[0-9]+$", (gchar *) deprecated, 0, 0)
== 0))
{
g_warning ("%s: invalid deprecated-by-nvd-id: %s",
__func__,
deprecated);
g_free (name);
g_free (status);
return -1;
}

nvd_id = element_attribute (item_metadata, "nvd-id");
if (nvd_id == NULL)
{
g_warning ("%s: nvd_id missing", __func__);
g_free (name);
g_free (status);
g_free (deprecated);
return -1;
}

Expand Down Expand Up @@ -2163,15 +2148,14 @@ insert_scap_cpe (inserts_t *inserts, element_t cpe_item, element_t item_metadata
first = inserts_check_size (inserts);

g_string_append_printf (inserts->statement,
"%s ('%s', '%s', '%s', %i, %i, '%s', %s, '%s')",
"%s ('%s', '%s', '%s', %i, %i, '%s', '%s')",
first ? "" : ",",
quoted_name,
quoted_name,
quoted_title,
modification_time,
modification_time,
quoted_status,
deprecated ? deprecated : "NULL",
quoted_nvd_id);

inserts->current_chunk_size++;
Expand All @@ -2180,7 +2164,6 @@ insert_scap_cpe (inserts_t *inserts, element_t cpe_item, element_t item_metadata
g_free (quoted_name);
g_free (quoted_status);
g_free (quoted_nvd_id);
g_free (deprecated);

return 0;
}
Expand Down
Loading