Skip to content

Commit 5bd1f7e

Browse files
committed
add checks to quiet coverity
1 parent 7e930d9 commit 5bd1f7e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/util/test/dns_tests.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ static void test_roundtrip_simple(void)
519519
enc_len = encode_label(buf, sizeof(buf), buf, "example.com", false, NULL);
520520
TEST_CHECK(enc_len > 0);
521521
TEST_MSG("encode returned %zd", enc_len);
522+
if (enc_len <= 0) return;
522523

523524
dec_len = fr_dns_label_to_value_box(ctx, &vb_out, buf, enc_len, buf, false, NULL);
524525
TEST_CHECK(dec_len > 0);
@@ -541,6 +542,7 @@ static void test_roundtrip_trailing_dot(void)
541542

542543
enc_len = encode_label(buf, sizeof(buf), buf, "example.com.", false, NULL);
543544
TEST_CHECK(enc_len > 0);
545+
if (enc_len <= 0) return;
544546

545547
dec_len = fr_dns_label_to_value_box(ctx, &vb_out, buf, enc_len, buf, false, NULL);
546548
TEST_CHECK(dec_len > 0);
@@ -561,6 +563,7 @@ static void test_roundtrip_root(void)
561563

562564
enc_len = encode_label(buf, sizeof(buf), buf, ".", false, NULL);
563565
TEST_CHECK(enc_len == 1);
566+
if (enc_len <= 0) return;
564567

565568
dec_len = fr_dns_label_to_value_box(ctx, &vb_out, buf, enc_len, buf, false, NULL);
566569
TEST_CHECK(dec_len > 0);
@@ -600,6 +603,7 @@ static void test_roundtrip_case_preservation(void)
600603

601604
enc_len = encode_label(buf, sizeof(buf), buf, "WWW.Example.COM", false, NULL);
602605
TEST_CHECK(enc_len > 0);
606+
if (enc_len <= 0) return;
603607

604608
dec_len = fr_dns_label_to_value_box(ctx, &vb_out, buf, enc_len, buf, false, NULL);
605609
TEST_CHECK(dec_len > 0);

0 commit comments

Comments
 (0)