From 0bbbe382a5b9d9906050629f531424b251302acf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Jun 2003 07:56:23 +0000 Subject: 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) --- source3/lib/charcnv.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3') 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 || \ -- cgit