summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-06-06 07:56:23 +0000
committerJeremy Allison <jra@samba.org>2003-06-06 07:56:23 +0000
commit0bbbe382a5b9d9906050629f531424b251302acf (patch)
tree71870e88ed9c2e42aa5991e7a1d75a1c98815f59 /source3
parentde3f1c77677c80cb27688521b39c5325bb4e3bd7 (diff)
downloadsamba-0bbbe382a5b9d9906050629f531424b251302acf.tar.gz
samba-0bbbe382a5b9d9906050629f531424b251302acf.tar.bz2
samba-0bbbe382a5b9d9906050629f531424b251302acf.zip
Fix for valgrind - when doing a srvstr_push we must zero fill
any extra bytes, not clobber region them - otherwise valgrind thinks they are invalid on send() or write(). Jeremy. (This used to be commit 8aa5f7a65c71fb89ed05e71a2465e61385e80c2b)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/charcnv.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 1a74318439..708ef343e1 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -723,8 +723,21 @@ size_t pull_utf8_allocate(void **dest, const char *src)
size_t push_string_fn(const char *function, unsigned int line, const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags)
{
+#ifdef DEVELOPER
+ /* We really need to zero fill here, not clobber
+ * region, as we want to ensure that valgrind thinks
+ * all of the outgoing buffer has been written to
+ * so a send() or write() won't trap an error.
+ * JRA.
+ */
+#if 0
if (dest_len != (size_t)-1)
clobber_region(function, line, dest, dest_len);
+#else
+ if (dest_len != (size_t)-1)
+ memset(dest, '\0', dest_len);
+#endif
+#endif
if (!(flags & STR_ASCII) && \
((flags & STR_UNICODE || \