From 47a31a8de792ba7b9e7aa2a42f49149d05d59ce7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 22 May 2007 20:52:00 +0000 Subject: [PATCH] kes Fix Verify InitCatalog mysql_escape_string() trashing memory. Make buffer bigger. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4881 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/mysql.c | 2 +- bacula/src/dird/fd_cmds.c | 6 +++--- bacula/technotes-2.1 | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 6c4d6b09e4..3fd611d42f 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -299,7 +299,7 @@ db_escape_string(char *snew, char *old, int len) { mysql_escape_string(snew, old, len); -#ifdef DO_IT_MYSELF +#ifdef xDO_IT_MYSELF /* Should use mysql_real_escape_string ! */ unsigned long mysql_real_escape_string(MYSQL *mysql, char *to, const char *from, unsigned long length); diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 057742e0b5..d0df6123b1 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -599,7 +599,7 @@ int get_attributes_and_put_in_catalog(JCR *jcr) BSOCK *fd; int n = 0; ATTR_DBR *ar = NULL; - char digest[CRYPTO_DIGEST_MAX_SIZE]; + char digest[MAXSTRING]; fd = jcr->file_bsock; jcr->jr.FirstIndex = 1; @@ -677,9 +677,9 @@ int get_attributes_and_put_in_catalog(JCR *jcr) stream_to_ascii(stream), file_index, jcr->FileIndex); continue; } - db_escape_string(digest, Digest, strlen(Digest)); ar->Digest = digest; ar->DigestType = crypto_digest_stream_type(stream); + db_escape_string(digest, Digest, strlen(Digest)); Dmsg4(dbglvl, "stream=%d DigestLen=%d Digest=%s type=%d\n", stream, strlen(digest), digest, ar->DigestType); } @@ -688,7 +688,7 @@ int get_attributes_and_put_in_catalog(JCR *jcr) } if (is_bnet_error(fd)) { Jmsg1(jcr, M_FATAL, 0, _("bstrerror()); return 0; } if (jcr->cached_attribute) { diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 08b1e74135..fee97325ef 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,8 @@ General: 22May07 +kes Fix Verify InitCatalog mysql_escape_string() trashing memory. + Make buffer bigger. kes Fix Verify InitCatalog. The attributes were not pointing to the correct saved location. kes Implement message callback so that GUI is sure to get all -- 2.39.5