From 2d1ca6dc77caf323aad6362d22fec38eeac553be Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 2 Nov 2009 20:29:25 +0100 Subject: [PATCH] Fix buffer clobber when editing SQL error --- bacula/src/cats/sql.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 49e9762010..5872fa3087 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -761,9 +761,11 @@ bool db_open_batch_connexion(JCR *jcr, B_DB *mdb) } if (!db_open_database(jcr, jcr->db_batch)) { - Mmsg2(&jcr->db_batch->errmsg, _("Could not open database \"%s\": ERR=%s\n"), + POOLMEM *errmsg = get_pool_memory(PM_MESSAGE); + Mmsg2(&errmsg, _("Could not open database \"%s\": ERR=%s\n"), jcr->db_batch->db_name, db_strerror(jcr->db_batch)); - Jmsg1(jcr, M_FATAL, 0, "%s", jcr->db_batch->errmsg); + Jmsg1(jcr, M_FATAL, 0, "%s", errmsg); + free_pool_memory(errmsg); return false; } Dmsg3(100, "initdb ref=%d connected=%d db=%p\n", jcr->db_batch->ref_count, -- 2.39.5