From 9136ed1c83211addea0d1ad9d5ff682ae729a039 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 12 Sep 2016 13:56:01 +0200 Subject: [PATCH] Attempt to fix bug #2237 --- bacula/src/cats/mysql.c | 1 + bacula/src/cats/postgresql.c | 1 + bacula/src/cats/sqlite.c | 1 + bacula/src/dird/catreq.c | 10 +++++++--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 52546b7dd4..529e6c55c3 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -443,6 +443,7 @@ void BDB_MYSQL::bdb_start_transaction(JCR *jcr) } if (!jcr->ar) { jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); + memset(jcr->ar, 0, sizeof(ATTR_DBR)); } } diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index 51d1a13fed..6794b4ae74 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -445,6 +445,7 @@ void BDB_POSTGRESQL::bdb_start_transaction(JCR *jcr) } if (!jcr->ar) { jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); + memset(jcr->ar, 0, sizeof(ATTR_DBR)); } /* diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 7dcbafe7f0..9ee8171021 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -378,6 +378,7 @@ void BDB_SQLITE::bdb_start_transaction(JCR *jcr) } if (!jcr->ar) { jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); + memset(jcr->ar, 0, sizeof(ATTR_DBR)); } if (!mdb->m_allow_transactions) { diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index d7341adeb4..ed0a736784 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -612,9 +612,13 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen) Stream); } - bin_to_base64(digestbuf, sizeof(digestbuf), fname, len, true); - Dmsg3(400, "DigestLen=%d Digest=%s type=%d\n", strlen(digestbuf), - digestbuf, Stream); + if (len != 0) { + bin_to_base64(digestbuf, sizeof(digestbuf), fname, len, true); + Dmsg3(400, "DigestLen=%d Digest=%s type=%d\n", strlen(digestbuf), + digestbuf, Stream); + } else { + digestbuf[0] = 0; + } if (jcr->cached_attribute) { ar->Digest = digestbuf; ar->DigestType = type; -- 2.39.5