summaryrefslogtreecommitdiff
path: root/chat/libotr/patches/patch-CVE-2012-3461-ab
diff options
context:
space:
mode:
Diffstat (limited to 'chat/libotr/patches/patch-CVE-2012-3461-ab')
-rw-r--r--chat/libotr/patches/patch-CVE-2012-3461-ab36
1 files changed, 36 insertions, 0 deletions
diff --git a/chat/libotr/patches/patch-CVE-2012-3461-ab b/chat/libotr/patches/patch-CVE-2012-3461-ab
new file mode 100644
index 00000000000..303da92fd1f
--- /dev/null
+++ b/chat/libotr/patches/patch-CVE-2012-3461-ab
@@ -0,0 +1,36 @@
+$NetBSD: patch-CVE-2012-3461-ab,v 1.1 2012/08/09 10:06:47 drochner Exp $
+
+--- src/b64.h.orig 2008-05-27 12:35:28.000000000 +0000
++++ src/b64.h
+@@ -20,6 +20,19 @@
+ #ifndef __B64_H__
+ #define __B64_H__
+
++#include <stdlib.h>
++
++/* Base64 encodes blocks of this many bytes: */
++#define OTRL_B64_DECODED_LEN 3
++/* into blocks of this many bytes: */
++#define OTRL_B64_ENCODED_LEN 4
++
++/* An encoded block of length encoded_len can turn into a maximum of
++ * this many decoded bytes: */
++#define OTRL_B64_MAX_DECODED_SIZE(encoded_len) \
++ (((encoded_len + OTRL_B64_ENCODED_LEN - 1) / OTRL_B64_ENCODED_LEN) \
++ * OTRL_B64_DECODED_LEN)
++
+ /*
+ * base64 encode data. Insert no linebreaks or whitespace.
+ *
+@@ -33,8 +46,9 @@ size_t otrl_base64_encode(char *base64da
+ * base64 decode data. Skip non-base64 chars, and terminate at the
+ * first '=', or the end of the buffer.
+ *
+- * The buffer data must contain at least (base64len / 4) * 3 bytes of
+- * space. This function will return the number of bytes actually used.
++ * The buffer data must contain at least ((base64len+3) / 4) * 3 bytes
++ * of space. This function will return the number of bytes actually
++ * used.
+ */
+ size_t otrl_base64_decode(unsigned char *data, const char *base64data,
+ size_t base64len);