Branch Coverage

src/ldns/dname.c
Criterion Covered Total %
branch 63 166 37.9


line true false branch
43 39 16 for (src_pos = 0; src_pos < ldns_rdf_size(dname); src_pos += len + 1) {
48 16 0 return src_pos > 0 && len == 0;
16 0 return src_pos > 0 && len == 0;
68 2 0 if (ldns_dname_last_label_is_root_label(rd1)) {
75 0 2 if (!buf) {
105 14 0 if (ldns_dname_last_label_is_root_label(rd1)) {
111 0 14 if(!newd) {
136 0 0 if (! buf) {
140 0 0 if (! new) {
147 0 0 if (ldns_dname_last_label_is_root_label(dname)) {
151 0 0 for (src_pos = 0; src_pos < rd_size; src_pos += len + 1) {
167 0 0 ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME ||
174 0 0 while (n > 0) {
177 0 0 if (data_size < label_size) {
194 0 82 if (!d) {
198 0 82 if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) {
201 0 82 if (ldns_dname_label_count(d) == 0) {
221 0 283 if (!r) {
229 0 283 if (ldns_rdf_get_type(r) != LDNS_RDF_TYPE_DNAME) {
235 34 249 if (1 == r_size) {
238 496 249 while ((len > 0) && src_pos < r_size) {
496 0 while ((len > 0) && src_pos < r_size) {
255 0 0 if (!rd) {
282 25 35 if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_DNAME) {
287 402 35 for (i = 0; i < ldns_rdf_size(rd); i++, rdd++) {
305 0 0 ldns_rdf_get_type(parent) != LDNS_RDF_TYPE_DNAME ||
320 0 0 if (sub_lab < par_lab) {
327 0 0 for (i = par_lab -1; i >= 0; i--) {
330 0 0 if (!tmp_sub || !tmp_par) {
0 0 if (!tmp_sub || !tmp_par) {
338 0 0 if (ldns_rdf_compare(tmp_sub, tmp_par) != 0) {
367 0 38 if (!dname1 && !dname2) {
0 0 if (!dname1 && !dname2) {
370 38 0 if (!dname1 || !dname2) {
0 38 if (!dname1 || !dname2) {
383 0 38 if (lc1 == 0 && lc2 == 0) {
0 0 if (lc1 == 0 && lc2 == 0) {
386 0 38 if (lc1 == 0) {
389 0 38 if (lc2 == 0) {
399 34 72 while (lc1f > 0) {
407 34 72 while (lc2f > 0) {
413 172 61 for (i = 1; i < (size_t)(*lp1 + 1); i++) {
414 0 172 if (i > *lp2) {
419 7 165 if (LDNS_DNAME_NORMALIZE((int) *(lp1 + i)) <
423 4 161 } else if (LDNS_DNAME_NORMALIZE((int) *(lp1 + i)) >
429 3 58 if (*lp1 < *lp2) {
434 24 34 if (lc1 == 0 && lc2 > 0) {
0 24 if (lc1 == 0 && lc2 > 0) {
437 34 24 } else if (lc1 > 0 && lc2 == 0) {
0 34 } else if (lc1 > 0 && lc2 == 0) {
440 24 34 } else if (lc1 == 0 && lc2 == 0) {
24 0 } else if (lc1 == 0 && lc2 == 0) {
455 0 0 return ( ldns_dname_label_count(dname) > 0 &&
456 0 0 ldns_rdf_data(dname)[0] == 1 &&
0 0 ldns_rdf_data(dname)[0] == 1 &&
466 0 0 if (ldns_dname_is_wildcard(wildcard)) {
499 0 0 if (next_check == 0) {
504 0 0 if ((prev_check == -1 || prev_check == 0) &&
0 0 if ((prev_check == -1 || prev_check == 0) &&
0 0 if ((prev_check == -1 || prev_check == 0) &&
518 169 0 if(dname_str && strcmp(dname_str, ".") == 0)
0 169 if(dname_str && strcmp(dname_str, ".") == 0)
520 169 0 if(!dname_str || strlen(dname_str) < 2)
0 169 if(!dname_str || strlen(dname_str) < 2)
522 119 50 if(dname_str[strlen(dname_str) - 1] != '.')
524 50 0 if(dname_str[strlen(dname_str) - 2] != '\\')
527 0 0 for(s=dname_str; *s; s++) {
528 0 0 if(*s == '\\') {
529 0 0 if(s[1] && s[2] && s[3] /* check length */
0 0 if(s[1] && s[2] && s[3] /* check length */
0 0 if(s[1] && s[2] && s[3] /* check length */
530 0 0 && isdigit(s[1]) && isdigit(s[2]) &&
533 0 0 else if(!s[1] || isdigit(s[1])) /* escape of nul,0-9 */
0 0 else if(!s[1] || isdigit(s[1])) /* escape of nul,0-9 */
537 0 0 else if(!*(s+1) && *s == '.')
0 0 else if(!*(s+1) && *s == '.')
547 0 0 if (str) {
565 0 80 if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_DNAME) {
574 80 0 while ((len > 0) && src_pos < s) {
80 0 while ((len > 0) && src_pos < s) {
575 80 0 if (labelcnt == labelpos) {
578 0 80 if (!data) {
586 0 80 if (!tmpnew) {