git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d4ff61d
)
Coverity: attempt to quieten null-deref whines about stringhandling
author
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 5 Mar 2016 18:39:14 +0000
(18:39 +0000)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Sat, 5 Mar 2016 18:39:14 +0000
(18:39 +0000)
src/src/string.c
patch
|
blob
|
history
diff --git
a/src/src/string.c
b/src/src/string.c
index 28d5780150e90bfe6318d5df2767b876a951d7e9..d7478721398a17abff43fb04fcbb4d7fc284d755 100644
(file)
--- 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.
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 *
*/
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
/* 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;
memcpy(string + p, s, count);
*ptr = p + count;
return string;