From 0f09809855c17890f785e49d97ab8f46f9e86df0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 12 Jun 2014 10:42:39 +1000 Subject: [PATCH 1/3] add INSISTs to silence tainted data false positive in Coverity (cherry picked from commit 8a2ff13c3dbf43c3a3f0ff8f24d9559ec2d72089) --- lib/dns/rdata/generic/tkey_249.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c index 6f1ec02538..09175615f6 100644 --- a/lib/dns/rdata/generic/tkey_249.c +++ b/lib/dns/rdata/generic/tkey_249.c @@ -465,6 +465,7 @@ tostruct_tkey(ARGS_TOSTRUCT) { /* * Key. */ + INSIST(tkey->keylen + 2 <= sr.length); tkey->key = mem_maybedup(mctx, sr.base, tkey->keylen); if (tkey->key == NULL) goto cleanup; @@ -479,6 +480,7 @@ tostruct_tkey(ARGS_TOSTRUCT) { /* * Other. */ + INSIST(tkey->otherlen <= sr.length); tkey->other = mem_maybedup(mctx, sr.base, tkey->otherlen); if (tkey->other == NULL) goto cleanup; From 615ff95bd1e5cf975d717762f43f3ef272315515 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 12 Jun 2014 10:49:53 +1000 Subject: [PATCH 2/3] add INSISTs to silence tainted data false positive in Coverity (cherry picked from commit 83a5c670b82ac019385c787839af4bc20ea06aef) --- lib/dns/rdata/generic/hip_55.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dns/rdata/generic/hip_55.c b/lib/dns/rdata/generic/hip_55.c index 5198497dcb..e69c2685a0 100644 --- a/lib/dns/rdata/generic/hip_55.c +++ b/lib/dns/rdata/generic/hip_55.c @@ -318,6 +318,8 @@ tostruct_hip(ARGS_TOSTRUCT) { goto cleanup; isc_region_consume(®ion, hip->hit_len); + INSIST(hip->key_len <= region.length); + hip->key = mem_maybedup(mctx, region.base, hip->key_len); if (hip->key == NULL) goto cleanup; From e3779a2642e3be32765d1145b1be21370ed25da1 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 12 Jun 2014 11:12:22 +1000 Subject: [PATCH 3/3] make lhs unsigned (cherry picked from commit 1208790272c8547682be4114ca3492477a3598b5) --- lib/dns/rdata/generic/tkey_249.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c index 09175615f6..4eab89bbd5 100644 --- a/lib/dns/rdata/generic/tkey_249.c +++ b/lib/dns/rdata/generic/tkey_249.c @@ -465,7 +465,7 @@ tostruct_tkey(ARGS_TOSTRUCT) { /* * Key. */ - INSIST(tkey->keylen + 2 <= sr.length); + INSIST(tkey->keylen + 2U <= sr.length); tkey->key = mem_maybedup(mctx, sr.base, tkey->keylen); if (tkey->key == NULL) goto cleanup;