Skip to content
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
7 changes: 6 additions & 1 deletion src/CVRF/cvrf_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
OSCAP_ACCESSOR_STRING(cvrf_remediation, url)
OSCAP_ACCESSOR_STRING(cvrf_remediation, entitlement)

cvrf_remediation_type_t cvrf_remediation_get_type(struct cvrf_remediation *remed) {

Check warning on line 78 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "remed" is "struct cvrf_remediation *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxN&open=AZ2dO2GUVhiUnHXXgFxN&pullRequest=2340
return remed->type;
}

struct oscap_string_iterator *cvrf_remediation_get_product_ids(struct cvrf_remediation *remed) {

Check warning on line 82 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "remed" is "struct cvrf_remediation *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxO&open=AZ2dO2GUVhiUnHXXgFxO&pullRequest=2340
return oscap_stringlist_get_strings(remed->product_ids);
}
struct oscap_string_iterator *cvrf_remediation_get_group_ids(struct cvrf_remediation *remed) {

Check warning on line 85 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "remed" is "struct cvrf_remediation *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxP&open=AZ2dO2GUVhiUnHXXgFxP&pullRequest=2340
return oscap_stringlist_get_strings(remed->group_ids);
}

Expand Down Expand Up @@ -138,7 +138,7 @@
OSCAP_ACCESSOR_STRING(cvrf_score_set, vector)
OSCAP_ACCESSOR_SIMPLE(struct cvss_impact*, cvrf_score_set, impact)

struct oscap_string_iterator *cvrf_score_set_get_product_ids(struct cvrf_score_set *score_set) {

Check warning on line 141 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "score_set" is "struct cvrf_score_set *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxQ&open=AZ2dO2GUVhiUnHXXgFxQ&pullRequest=2340
return oscap_stringlist_get_strings(score_set->product_ids);
}

Expand All @@ -149,7 +149,7 @@
}

static char *cvrf_score_set_get_score(const struct cvrf_score_set *score_set, enum cvss_category category) {
struct cvss_metrics *metric = NULL;

Check warning on line 152 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this variable a pointer-to-const. The current type of "metric" is "struct cvss_metrics *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxR&open=AZ2dO2GUVhiUnHXXgFxR&pullRequest=2340
if (category == CVSS_BASE) {
metric = cvss_impact_get_base_metrics(score_set->impact);
} else if (category == CVSS_ENVIRONMENTAL) {
Expand Down Expand Up @@ -223,13 +223,13 @@
OSCAP_ACCESSOR_STRING(cvrf_threat, date)
OSCAP_ACCESSOR_STRING(cvrf_threat, description)

cvrf_threat_type_t cvrf_threat_get_threat_type(struct cvrf_threat *threat) {

Check warning on line 226 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "threat" is "struct cvrf_threat *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxS&open=AZ2dO2GUVhiUnHXXgFxS&pullRequest=2340
return threat->type;
}
struct oscap_string_iterator *cvrf_threat_get_product_ids(struct cvrf_threat *threat) {

Check warning on line 229 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "threat" is "struct cvrf_threat *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxT&open=AZ2dO2GUVhiUnHXXgFxT&pullRequest=2340
return oscap_stringlist_get_strings(threat->product_ids);
}
struct oscap_string_iterator *cvrf_threat_get_group_ids(struct cvrf_threat *threat) {

Check warning on line 232 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "threat" is "struct cvrf_threat *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxU&open=AZ2dO2GUVhiUnHXXgFxU&pullRequest=2340
return oscap_stringlist_get_strings(threat->group_ids);
}

Expand Down Expand Up @@ -280,7 +280,7 @@
struct oscap_string_iterator *cvrf_product_status_get_ids(struct cvrf_product_status *stat) {
return oscap_stringlist_get_strings(stat->product_ids);
}
cvrf_product_status_type_t cvrf_product_status_get_type(struct cvrf_product_status *stat) {

Check warning on line 283 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "stat" is "struct cvrf_product_status *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxW&open=AZ2dO2GUVhiUnHXXgFxW&pullRequest=2340
return stat->type;
}

Expand Down Expand Up @@ -320,7 +320,7 @@
};
OSCAP_ACCESSOR_STRING(cvrf_involvement, description)

cvrf_involvement_status_type_t cvrf_involvement_get_status_type(struct cvrf_involvement *involve) {

Check warning on line 323 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "involve" is "struct cvrf_involvement *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxX&open=AZ2dO2GUVhiUnHXXgFxX&pullRequest=2340
return involve->status;
}

Expand Down Expand Up @@ -499,7 +499,7 @@
clone->ordinal = vuln->ordinal;
clone->title = oscap_strdup(vuln->title);
clone->system_id = oscap_strdup(vuln->system_id);
clone->system_id = oscap_strdup(vuln->system_name);
clone->system_name = oscap_strdup(vuln->system_name);
clone->discovery_date = oscap_strdup(vuln->discovery_date);
clone->release_date = oscap_strdup(vuln->release_date);
clone->cwes = oscap_list_clone(vuln->cwes, (oscap_clone_func) cvrf_vulnerability_cwe_clone);
Expand Down Expand Up @@ -597,7 +597,7 @@
OSCAP_ACCESSOR_STRING(cvrf_group, group_id)
OSCAP_ACCESSOR_STRING(cvrf_group, description)

struct oscap_string_iterator *cvrf_group_get_product_ids(struct cvrf_group *group) {

Check warning on line 600 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "group" is "struct cvrf_group *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxa&open=AZ2dO2GUVhiUnHXXgFxa&pullRequest=2340
return oscap_stringlist_get_strings(group->product_ids);
}

Expand Down Expand Up @@ -643,7 +643,7 @@
OSCAP_ACCESSOR_STRING(cvrf_relationship, relates_to_ref)
OSCAP_ACCESSOR_SIMPLE(struct cvrf_product_name*, cvrf_relationship, product_name)

cvrf_relationship_type_t cvrf_relationship_get_relation_type(struct cvrf_relationship *relation) {

Check warning on line 646 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "relation" is "struct cvrf_relationship *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxb&open=AZ2dO2GUVhiUnHXXgFxb&pullRequest=2340
return relation->relation_type;
}

Expand Down Expand Up @@ -695,7 +695,7 @@
return oscap_iterator_new(branch->subbranches);
}

cvrf_branch_type_t cvrf_branch_get_branch_type(struct cvrf_branch *branch) {

Check warning on line 698 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "branch" is "struct cvrf_branch *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxc&open=AZ2dO2GUVhiUnHXXgFxc&pullRequest=2340
return branch->type;
}

Expand Down Expand Up @@ -818,7 +818,7 @@
struct oscap_list *filtered_relation = oscap_list_new();
struct cvrf_relationship_iterator *relationships = cvrf_product_tree_get_relationships(tree);
while (cvrf_relationship_iterator_has_more(relationships)) {
struct cvrf_relationship *relation = cvrf_relationship_iterator_next(relationships);

Check warning on line 821 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this variable a pointer-to-const. The current type of "relation" is "struct cvrf_relationship *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxd&open=AZ2dO2GUVhiUnHXXgFxd&pullRequest=2340
if (!strcmp(branch_id, cvrf_relationship_get_relates_to_ref(relation)))
oscap_list_add(filtered_relation, cvrf_relationship_clone(relation));
}
Expand Down Expand Up @@ -1008,10 +1008,10 @@
OSCAP_ACCESSOR_STRING(cvrf_doc_tracking, generator_engine)
OSCAP_ACCESSOR_STRING(cvrf_doc_tracking, generator_date)

cvrf_doc_status_type_t cvrf_doc_tracking_get_status(struct cvrf_doc_tracking *tracking) {

Check warning on line 1011 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "tracking" is "struct cvrf_doc_tracking *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxe&open=AZ2dO2GUVhiUnHXXgFxe&pullRequest=2340
return tracking->status;
}
struct oscap_string_iterator *cvrf_doc_tracking_get_aliases(struct cvrf_doc_tracking *tracking) {

Check warning on line 1014 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "tracking" is "struct cvrf_doc_tracking *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxf&open=AZ2dO2GUVhiUnHXXgFxf&pullRequest=2340
return oscap_stringlist_get_strings(tracking->aliases);
}

Expand Down Expand Up @@ -1075,7 +1075,7 @@
OSCAP_ACCESSOR_STRING(cvrf_doc_publisher, contact_details)
OSCAP_ACCESSOR_STRING(cvrf_doc_publisher, issuing_authority)

cvrf_doc_publisher_type_t cvrf_doc_publisher_get_type(struct cvrf_doc_publisher *publisher) {

Check warning on line 1078 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "publisher" is "struct cvrf_doc_publisher *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxg&open=AZ2dO2GUVhiUnHXXgFxg&pullRequest=2340
return publisher->type;
}

Expand Down Expand Up @@ -1123,7 +1123,7 @@
OSCAP_ACCESSOR_STRING(cvrf_reference, url)
OSCAP_ACCESSOR_STRING(cvrf_reference, description)

cvrf_reference_type_t cvrf_reference_get_reference_type(struct cvrf_reference *reference) {

Check warning on line 1126 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "reference" is "struct cvrf_reference *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxh&open=AZ2dO2GUVhiUnHXXgFxh&pullRequest=2340
return reference->type;
}

Expand Down Expand Up @@ -1252,8 +1252,8 @@
return model->tree;
}

const char *cvrf_model_get_identification(struct cvrf_model *model) {

Check warning on line 1255 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "model" is "struct cvrf_model *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxi&open=AZ2dO2GUVhiUnHXXgFxi&pullRequest=2340
struct cvrf_doc_tracking *tracking = cvrf_document_get_tracking(model->document);

Check warning on line 1256 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this variable a pointer-to-const. The current type of "tracking" is "struct cvrf_doc_tracking *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxj&open=AZ2dO2GUVhiUnHXXgFxj&pullRequest=2340
return (cvrf_doc_tracking_get_tracking_id(tracking));
}

Expand Down Expand Up @@ -1442,12 +1442,12 @@
}

static void cvrf_parse_container(xmlTextReaderPtr reader, struct oscap_list *list) {
cvrf_item_type_t item_type = cvrf_item_type_from_text((char *)xmlTextReaderConstLocalName(reader));

Check failure on line 1445 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const unsigned char *' to 'char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw2&open=AZ2dO2GUVhiUnHXXgFw2&pullRequest=2340
const char *tag = cvrf_item_type_get_text(item_type);
if (item_type != CVRF_VULNERABILITY && item_type != CVRF_VULNERABILITY_CWE)
xmlTextReaderNextElement(reader);
bool error = false;
while (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST tag) == 0) {

Check failure on line 1450 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw3&open=AZ2dO2GUVhiUnHXXgFw3&pullRequest=2340
if (item_type == CVRF_REVISION) {
error = !oscap_list_add(list, cvrf_revision_parse(reader));
} else if (item_type == CVRF_NOTE || item_type == CVRF_DOCUMENT_NOTE) {
Expand Down Expand Up @@ -1484,7 +1484,7 @@

static char *cvrf_parse_element(xmlTextReaderPtr reader, const char *tagname, bool next_elm) {
char *elm_value = NULL;
if (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST tagname) == 0) {

Check failure on line 1487 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw4&open=AZ2dO2GUVhiUnHXXgFw4&pullRequest=2340
elm_value = oscap_element_string_copy(reader);
if (next_elm)
xmlTextReaderNextElement(reader);
Expand All @@ -1509,7 +1509,7 @@

if (parent == NULL) {
const char *container_tag = cvrf_item_type_get_container(cvrf_type);
parent = xmlNewNode(NULL, BAD_CAST container_tag);

Check failure on line 1512 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw5&open=AZ2dO2GUVhiUnHXXgFw5&pullRequest=2340
}
xmlNode *child = NULL;
struct oscap_iterator *it = oscap_iterator_new(list);
Expand Down Expand Up @@ -1564,7 +1564,7 @@
struct oscap_string_iterator *iterator = oscap_stringlist_get_strings(list);
while (oscap_string_iterator_has_more(iterator)) {
const char *string = oscap_string_iterator_next(iterator);
xmlNewTextChild(parent, NULL, BAD_CAST tag_name, BAD_CAST string);

Check failure on line 1567 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw6&open=AZ2dO2GUVhiUnHXXgFw6&pullRequest=2340

Check failure on line 1567 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw7&open=AZ2dO2GUVhiUnHXXgFw7&pullRequest=2340
}
oscap_string_iterator_free(iterator);
}
Expand All @@ -1573,7 +1573,7 @@
if (attr_value == NULL)
return;

xmlNewProp(element, BAD_CAST attr_name, BAD_CAST attr_value);

Check failure on line 1576 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw8&open=AZ2dO2GUVhiUnHXXgFw8&pullRequest=2340
}

static void cvrf_element_add_ordinal(int ordinal, xmlNode *element) {
Expand All @@ -1594,8 +1594,8 @@
if (elm_value == NULL)
return NULL;

xmlNode *elm_node = xmlNewNode(NULL, BAD_CAST elm_name);

Check failure on line 1597 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw-&open=AZ2dO2GUVhiUnHXXgFw-&pullRequest=2340
xmlNodeAddContent(elm_node, BAD_CAST elm_value);

Check failure on line 1598 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFw_&open=AZ2dO2GUVhiUnHXXgFw_&pullRequest=2340
return elm_node;
}

Expand Down Expand Up @@ -1623,7 +1623,7 @@
oscap_stringlist_add_string(remed->product_ids, oscap_element_string_get(reader));
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_GROUP_ID) == 0) {
oscap_stringlist_add_string(remed->group_ids, oscap_element_string_get(reader));
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST "Entitlement") == 0) {

Check failure on line 1626 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxA&open=AZ2dO2GUVhiUnHXXgFxA&pullRequest=2340
remed->entitlement = oscap_element_string_copy(reader);
}
xmlTextReaderNextNode(reader);
Expand All @@ -1637,7 +1637,7 @@
cvrf_element_add_attribute("Type", cvrf_remediation_type_get_text(remed->type), remed_node);

xmlNode *desc_node = cvrf_element_to_dom("Description", remed->description);
xmlNewProp(desc_node, ATTR_LANG, BAD_CAST "en");

Check failure on line 1640 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxB&open=AZ2dO2GUVhiUnHXXgFxB&pullRequest=2340
xmlAddChild(remed_node, desc_node);
cvrf_element_add_child("URL", remed->url, remed_node);
cvrf_element_add_child("Entitlement", remed->entitlement, remed_node);
Expand Down Expand Up @@ -1808,7 +1808,7 @@
if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_TITLE) == 0) {
vuln->title = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_ID) == 0) {
vuln->system_name = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "SystemName");

Check failure on line 1811 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxC&open=AZ2dO2GUVhiUnHXXgFxC&pullRequest=2340
vuln->system_id = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_DISCOVERY_DATE) == 0) {
vuln->discovery_date = oscap_element_string_copy(reader);
Expand All @@ -1816,7 +1816,7 @@
vuln->release_date = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_VULNERABILITY_CVE) == 0) {
vuln->cve_id = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST "Notes") == 0) {

Check failure on line 1819 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxD&open=AZ2dO2GUVhiUnHXXgFxD&pullRequest=2340
cvrf_parse_container(reader, vuln->notes);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_VULNERABILITY_CWE) == 0) {
cvrf_parse_container(reader, vuln->cwes);
Expand Down Expand Up @@ -1852,7 +1852,7 @@

cvrf_element_add_child("Title", vuln->title, vuln_node);
if (vuln->system_id) {
xmlNode *id_node = xmlNewTextChild(vuln_node, NULL, BAD_CAST "ID", BAD_CAST vuln->system_id);

Check failure on line 1855 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxE&open=AZ2dO2GUVhiUnHXXgFxE&pullRequest=2340
cvrf_element_add_attribute("SystemName", vuln->system_name, id_node);
}
cvrf_element_add_container(vuln->notes, CVRF_NOTE, vuln_node);
Expand Down Expand Up @@ -1880,7 +1880,7 @@
return full_name;
}

xmlNode *cvrf_product_name_to_dom(struct cvrf_product_name *full_name) {

Check warning on line 1883 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "full_name" is "struct cvrf_product_name *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxk&open=AZ2dO2GUVhiUnHXXgFxk&pullRequest=2340
if (full_name->cpe == NULL)
return NULL;

Expand Down Expand Up @@ -1999,7 +1999,7 @@
cvrf_set_parsing_error("FullProductName");
} else if (!xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_BRANCH)) {
while(xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_BRANCH) == 0) {
if (!oscap_list_add(tree->branches, cvrf_branch_parse(reader)))

Check failure on line 2002 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest more than 3 if|for|do|while|switch statements.

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxl&open=AZ2dO2GUVhiUnHXXgFxl&pullRequest=2340
cvrf_set_parsing_error("Branch");
}
} else if (!xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_RELATIONSHIP)) {
Expand Down Expand Up @@ -2068,8 +2068,10 @@
continue;
}
if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_URL) == 0) {
free(ref->url);
ref->url = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_DESCRIPTION) == 0) {
free(ref->description);
ref->description = oscap_element_string_copy(reader);
}
xmlTextReaderNextNode(reader);
Expand All @@ -2078,7 +2080,7 @@
return ref;
}

xmlNode *cvrf_reference_to_dom(struct cvrf_reference *ref) {

Check warning on line 2083 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "ref" is "struct cvrf_reference *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxm&open=AZ2dO2GUVhiUnHXXgFxm&pullRequest=2340
xmlNode *ref_node = xmlNewNode(NULL, TAG_REFERENCE);
cvrf_element_add_attribute("Type", cvrf_reference_type_get_text(ref->type), ref_node);
cvrf_element_add_child("URL", ref->url, ref_node);
Expand All @@ -2097,7 +2099,7 @@

note->ordinal = cvrf_parse_ordinal(reader);
note->type = cvrf_note_type_parse(reader);
note->audience = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "Audience");

Check failure on line 2102 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxF&open=AZ2dO2GUVhiUnHXXgFxF&pullRequest=2340
note->title = (char *)xmlTextReaderGetAttribute(reader, TAG_TITLE);
xmlTextReaderNextNode(reader);
note->contents =oscap_element_string_copy(reader);
Expand All @@ -2106,7 +2108,7 @@
return note;
}

xmlNode *cvrf_note_to_dom(struct cvrf_note *note) {

Check warning on line 2111 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "note" is "struct cvrf_note *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxn&open=AZ2dO2GUVhiUnHXXgFxn&pullRequest=2340
xmlNode *note_node = cvrf_element_to_dom("Note", note->contents);
cvrf_element_add_ordinal(note->ordinal, note_node);
cvrf_element_add_attribute("Type", cvrf_note_type_get_text(note->type), note_node);
Expand All @@ -2125,10 +2127,13 @@
continue;
}
if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_NUMBER) == 0) {
free(revision->number);
revision->number = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_DATE) == 0) {
free(revision->date);
revision->date = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_DESCRIPTION) == 0) {
free(revision->description);
revision->description = oscap_element_string_copy(reader);
}
xmlTextReaderNextNode(reader);
Expand Down Expand Up @@ -2164,7 +2169,7 @@
xmlTextReaderNextElementWE(reader, TAG_IDENTIFICATION);
tracking->tracking_id = cvrf_parse_element(reader, "ID", false);
while (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_IDENTIFICATION) != 0) {
if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_ALIAS) == 0) {

Check failure on line 2172 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest more than 3 if|for|do|while|switch statements.

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxp&open=AZ2dO2GUVhiUnHXXgFxp&pullRequest=2340
oscap_stringlist_add_string(tracking->aliases, cvrf_parse_element(reader, "Alias", false));
xmlTextReaderNextNode(reader);
}
Expand All @@ -2176,9 +2181,9 @@
tracking->version = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_REVISION_HISTORY) == 0) {
cvrf_parse_container(reader, tracking->revision_history);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST "InitialReleaseDate") == 0) {

Check failure on line 2184 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxG&open=AZ2dO2GUVhiUnHXXgFxG&pullRequest=2340
tracking->init_release_date = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST "CurrentReleaseDate") == 0) {

Check failure on line 2186 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxH&open=AZ2dO2GUVhiUnHXXgFxH&pullRequest=2340
tracking->cur_release_date = oscap_element_string_copy(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_GENERATOR) == 0) {
xmlTextReaderNextElementWE(reader, TAG_GENERATOR);
Expand Down Expand Up @@ -2209,7 +2214,7 @@
cvrf_element_add_child("InitialReleaseDate", tracking->init_release_date, tracking_node);
cvrf_element_add_child("CurrentReleaseDate", tracking->cur_release_date, tracking_node);
if (tracking->generator_engine) {
xmlNode *generator_node = xmlNewTextChild(tracking_node, NULL, BAD_CAST "Generator", NULL);

Check failure on line 2217 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxI&open=AZ2dO2GUVhiUnHXXgFxI&pullRequest=2340
cvrf_element_add_child("Engine", tracking->generator_engine, generator_node);
cvrf_element_add_child("Date", tracking->generator_date, generator_node);
}
Expand All @@ -2233,7 +2238,7 @@
return publisher;
}

xmlNode *cvrf_doc_publisher_to_dom(struct cvrf_doc_publisher *publisher) {

Check warning on line 2241 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "publisher" is "struct cvrf_doc_publisher *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxq&open=AZ2dO2GUVhiUnHXXgFxq&pullRequest=2340
xmlNode *pub_node = xmlNewNode(NULL, TAG_PUBLISHER);
cvrf_element_add_attribute("Type", cvrf_doc_publisher_type_get_text(publisher->type), pub_node);
cvrf_element_add_child("ContactDetails", publisher->contact_details, pub_node);
Expand All @@ -2254,7 +2259,7 @@
doc->publisher = cvrf_doc_publisher_parse(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_DOCUMENT_TRACKING) == 0) {
doc->tracking = cvrf_doc_tracking_parse(reader);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST "DocumentNotes") == 0) {

Check failure on line 2262 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxJ&open=AZ2dO2GUVhiUnHXXgFxJ&pullRequest=2340
cvrf_parse_container(reader, doc->doc_notes);
} else if (xmlStrcmp(xmlTextReaderConstLocalName(reader), TAG_DISTRIBUTION) == 0) {
doc->doc_distribution = oscap_element_string_copy(reader);
Expand Down Expand Up @@ -2307,15 +2312,15 @@
return ret;
}

xmlNode *cvrf_model_to_dom(struct cvrf_model *model, xmlDocPtr doc, xmlNode *parent, void *user_args) {

Check warning on line 2315 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused parameter "user_args", make it unnamed, or declare it "[[maybe_unused]]".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxr&open=AZ2dO2GUVhiUnHXXgFxr&pullRequest=2340
xmlNode *root_node = xmlNewNode(NULL, BAD_CAST "cvrfdoc");

Check failure on line 2316 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxK&open=AZ2dO2GUVhiUnHXXgFxK&pullRequest=2340
if (parent == NULL) {
xmlDocSetRootElement(doc, root_node);
} else {
xmlAddChild(parent, root_node);
}
xmlNewNs(root_node, CVRF_NS, NULL);
xmlNewNs(root_node, CVRF_NS, BAD_CAST "cvrf");

Check failure on line 2323 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxL&open=AZ2dO2GUVhiUnHXXgFxL&pullRequest=2340
xmlNode *title_node = xmlNewTextChild(root_node, NULL, TAG_DOC_TITLE, BAD_CAST model->doc_title);
cvrf_element_add_attribute("xml:lang", "en", title_node);
cvrf_element_add_child("DocumentType", model->doc_type, root_node);
Expand All @@ -2341,8 +2346,8 @@
return index;
}

xmlNode *cvrf_index_to_dom(struct cvrf_index *index, xmlDocPtr doc, xmlNode *parent, void *user_args) {

Check warning on line 2349 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make the type of this parameter a pointer-to-const. The current type of "index" is "struct cvrf_index *".

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxs&open=AZ2dO2GUVhiUnHXXgFxs&pullRequest=2340
xmlNode *index_node = xmlNewNode(NULL, BAD_CAST "Index");

Check failure on line 2350 in src/CVRF/cvrf_priv.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

cast from 'const char *' to 'unsigned char *' drops const qualifier

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ2dO2GUVhiUnHXXgFxM&open=AZ2dO2GUVhiUnHXXgFxM&pullRequest=2340
if (parent == NULL) {
xmlDocSetRootElement(doc, index_node);
} else {
Expand Down
Loading