From 75b2610e85c07f25abdab6f98faf7ecda6e64fbf Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 7 May 2019 15:35:55 +0200 Subject: [PATCH] Fix TAINTED_SCALAR false positives of Coverity Coverity Analysis 2019.03 incorrectly marks the input argument of base64_encode(), and conseuqnetly base64_encode_alloc(), as tainted_data_sink because it sees byte-level operations on the input. This one-line annotation makes Coverity suppress the following false positives: Error: TAINTED_SCALAR: lib/luks2/luks2_digest_pbkdf2.c:117: tainted_data_argument: Calling function "crypt_random_get" taints argument "salt". lib/luks2/luks2_digest_pbkdf2.c:157: tainted_data: Passing tainted variable "salt" to a tainted sink. Error: TAINTED_SCALAR: lib/luks2/luks2_keyslot_luks2.c:445: tainted_data_argument: Calling function "crypt_random_get" taints argument "salt". lib/luks2/luks2_keyslot_luks2.c:448: tainted_data: Passing tainted variable "salt" to a tainted sink. --- lib/base64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/base64.c b/lib/base64.c index bb4dce86..51bee207 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -84,6 +84,7 @@ base64_encode_fast (const char *restrict in, size_t inlen, char *restrict out) If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as possible. If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero terminate the output buffer. */ +/* coverity[-tainted_data_sink: arg-0] */ void base64_encode (const char *restrict in, size_t inlen, char *restrict out, size_t outlen)