Skip to content
Snippets Groups Projects
Commit f337635a authored by Jan Kadlec's avatar Jan Kadlec
Browse files

coverity: fix for #1245647

parent 163c01e0
Branches
Tags
No related merge requests found
...@@ -161,7 +161,7 @@ uint32_t knot_rrset_ttl(const knot_rrset_t *rrset) ...@@ -161,7 +161,7 @@ uint32_t knot_rrset_ttl(const knot_rrset_t *rrset)
int knot_rrset_rr_to_canonical(knot_rrset_t *rrset) int knot_rrset_rr_to_canonical(knot_rrset_t *rrset)
{ {
if (rrset == NULL) { if (rrset == NULL || rrset->rrs.rr_count != 1) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
...@@ -182,11 +182,12 @@ int knot_rrset_rr_to_canonical(knot_rrset_t *rrset) ...@@ -182,11 +182,12 @@ int knot_rrset_rr_to_canonical(knot_rrset_t *rrset)
} }
knot_rdata_t *rdata = knot_rdataset_at(&rrset->rrs, 0); knot_rdata_t *rdata = knot_rdataset_at(&rrset->rrs, 0);
assert(rdata);
uint16_t rdlen = knot_rdata_rdlen(rdata); uint16_t rdlen = knot_rdata_rdlen(rdata);
uint8_t *pos = knot_rdata_data(rdata); uint8_t *pos = knot_rdata_data(rdata);
/* No RDATA */ /* No RDATA */
if (rdata == NULL || rdlen == 0) { if (rdlen == 0) {
return KNOT_EOK; return KNOT_EOK;
} }
......
...@@ -184,7 +184,7 @@ uint32_t knot_rrset_ttl(const knot_rrset_t *rrset); ...@@ -184,7 +184,7 @@ uint32_t knot_rrset_ttl(const knot_rrset_t *rrset);
* \note If RRSet with more RRs is given to this function, only the first RR * \note If RRSet with more RRs is given to this function, only the first RR
* will be converted. * will be converted.
* \warning This function expects either empty RDATA or full, not malformed * \warning This function expects either empty RDATA or full, not malformed
* RDATA. I malformed RRSet is passed to this function, memory errors * RDATA. If malformed RRSet is passed to this function, memory errors
* may occur. * may occur.
* *
* \param rrset RR to convert. * \param rrset RR to convert.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment