diff --git a/src/dnslib/rdata.c b/src/dnslib/rdata.c
index 2cb3d89114f72545ae22dfc40a2b37108cc454b1..51ac0b1cdc96aa0352368b6e8868321d8265510d 100644
--- a/src/dnslib/rdata.c
+++ b/src/dnslib/rdata.c
@@ -285,8 +285,11 @@ int dnslib_rdata_compare( const dnslib_rdata_t *r1, const dnslib_rdata_t *r2,
 		case DNSLIB_RDATA_WF_COMPRESSED_DNAME:
 		case DNSLIB_RDATA_WF_UNCOMPRESSED_DNAME:
 		case DNSLIB_RDATA_WF_LITERAL_DNAME:
-			// maybe also compare with dnslib_rdata_compare_binary()
-			cmp = dnslib_dname_compare(item1->dname, item2->dname);
+			cmp = dnslib_rdata_compare_binary(
+					dnslib_dname_name(item1->dname),
+					dnslib_dname_name(item2->dname),
+					dnslib_dname_size(item1->dname),
+					dnslib_dname_size(item2->dname));
 			break;
 		case DNSLIB_RDATA_WF_BYTE:
 			cmp = (item1->int8 == item2->int8) ? 0 : (