diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-05 18:39:14 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2016-03-05 18:39:14 +0000 |
commit | a1b8a755528674c2ac1652eacb4f2c835f6751b6 (patch) | |
tree | 45eb8466703f32275f3893699ba920b876c5c1bd | |
parent | d4ff61d1edff4054497632be7f36ede86bb8ebec (diff) |
Coverity: attempt to quieten null-deref whines about stringhandling
-rw-r--r-- | src/src/string.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/src/string.c b/src/src/string.c index 28d578015..d74787213 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -1086,6 +1086,8 @@ Returns: pointer to the start of the string, changed if copied for expansion. Note that a NUL is not added, though space is left for one. This is because string_cat() is often called multiple times to build up a string - there's no point adding the NUL till the end. + +coverity[+alloc] */ uschar * @@ -1132,8 +1134,14 @@ if (p + count >= *size) /* Because we always specify the exact number of characters to copy, we can use memcpy(), which is likely to be more efficient than strncopy() because the -latter has to check for zero bytes. */ +latter has to check for zero bytes. + +The Coverity annotation deals with the lack of correlated variable tracking; +common use is a null string and zero size and pointer, on first use for a +string being built. The "if" above then allocates, but Coverity assume that +the "if" might not happen and whines for a null-deref done by the memcpy(). */ +/* coverity[var_deref_op] */ memcpy(string + p, s, count); *ptr = p + count; return string; |