[Pkg-privacy-commits] [libotr] 82/225: One more otrl_base64_decode in the toolkit
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:44:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository libotr.
commit fe57dd874d656e62ea7c3b7d482fbb4a63f57006
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date: Thu Jul 19 10:50:44 2012 -0400
One more otrl_base64_decode in the toolkit
---
ChangeLog | 5 +++--
toolkit/parse.c | 7 +++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4684415..b774997 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
2012-07-19
- * src/b64.[ch], src/proto.c: Clean up the previous b64 patch
- and apply it to all places where otrl_base64_decode() is called.
+ * src/b64.[ch], src/proto.c, toolkir/parse.c: Clean up the
+ previous b64 patch and apply it to all places where
+ otrl_base64_decode() is called.
2012-07-17
diff --git a/toolkit/parse.c b/toolkit/parse.c
index 36f935e..fac75d6 100644
--- a/toolkit/parse.c
+++ b/toolkit/parse.c
@@ -65,6 +65,7 @@ static unsigned char *decode(const char *msg, size_t *lenp)
{
const char *header, *footer;
unsigned char *raw;
+ size_t rawlen;
/* Find the header */
header = strstr(msg, "?OTR:");
@@ -76,8 +77,10 @@ static unsigned char *decode(const char *msg, size_t *lenp)
footer = strchr(header, '.');
if (!footer) footer = header + strlen(header);
- raw = malloc((footer-header) / 4 * 3);
- if (raw == NULL && (footer-header >= 4)) return NULL;
+ rawlen = OTRL_B64_MAX_DECODED_SIZE(footer-header);
+
+ raw = malloc(rawlen);
+ if (raw == NULL && rawlen > 0) return NULL;
*lenp = otrl_base64_decode(raw, header, footer-header);
return raw;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git
More information about the Pkg-privacy-commits
mailing list