Skip to content

Commit

Permalink
Fix: Remove the insertion of unused deprecated-by-id from XML
Browse files Browse the repository at this point in the history
CPE feed files
  • Loading branch information
a-h-abdelsalam committed Nov 11, 2024
1 parent 1db428c commit 7cb34b7
Showing 1 changed file with 2 additions and 19 deletions.
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

0 comments on commit 7cb34b7

Please sign in to comment.