From 256be7a33a6f38f340252794c06a2f969a59a295 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Tue, 20 Mar 2001 22:18:50 +0000 Subject: [PATCH] Derek Atkins' patch to the rpc backend. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3810 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/rpc/RpcUtils.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/engine/rpc/RpcUtils.c b/src/engine/rpc/RpcUtils.c index 99278db951..eb908430fc 100644 --- a/src/engine/rpc/RpcUtils.c +++ b/src/engine/rpc/RpcUtils.c @@ -1199,8 +1199,16 @@ static void rpcend_do_build_gncquery (gncQuery *gq, gncQuery *from_q, case PD_STRING: PINFO ("BLAH... It's a string. I hope it doesn't have a Regex!"); default: - term = malloc (sizeof (*term)); - memcpy (term, andlist->qt, sizeof (*term)); + /* Allocate the right size */ + if (toRpc) { + term = malloc (sizeof (*term)); + memset (term, 0, sizeof (*term)); + } else { + term = malloc (sizeof (*qt)); + memset (term, 0, sizeof (*qt)); + } + /* Only copy the smaller size */ + memcpy (term, andlist->qt, MIN(sizeof (*qt), sizeof(*term))); } /* Set the predicate for non-rpc copies */