summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-10-16 22:04:41 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-10-16 22:04:41 (GMT)
commitcc53c9b1124b464556ba29a4a91a33628b3efe14 (patch)
tree36938b81248690a41fb3baa4e55a8dc643afdfc7 /plugins
parent015a0f3979b24f222317b305b056211515f9a64f (diff)
Fix some bugs in the base64 implementation.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/encodings/base64.c6
-rw-r--r--plugins/encodings/python/Makefile.am3
-rw-r--r--plugins/encodings/python/rost/Makefile.am3
3 files changed, 8 insertions, 4 deletions
diff --git a/plugins/encodings/base64.c b/plugins/encodings/base64.c
index 61b88e0..c749a87 100644
--- a/plugins/encodings/base64.c
+++ b/plugins/encodings/base64.c
@@ -54,8 +54,8 @@ bool _base64_encode(const sized_binary_t *input, sized_string_t *output, const s
output->len = input->len * 4 / 3;
- if (input->len % 3 != 0)
- output->len++;
+ if (output->len % 4 != 0)
+ output->len += (4 - output->len % 4);
output->data = malloc((output->len + 1) * sizeof(bin_t));
@@ -78,6 +78,8 @@ bool _base64_encode(const sized_binary_t *input, sized_string_t *output, const s
*iter++ = alpha[src[i + 2] & 0x3f];
}
+ else
+ i = 0;
/* Bourrage final ? */
diff --git a/plugins/encodings/python/Makefile.am b/plugins/encodings/python/Makefile.am
index f999f9f..523a6f4 100644
--- a/plugins/encodings/python/Makefile.am
+++ b/plugins/encodings/python/Makefile.am
@@ -8,7 +8,8 @@ libencodingspython_la_SOURCES = \
libencodingspython_la_LIBADD = \
rost/libencodingspythonrost.la
-libencodingspython_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
+libencodingspython_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) \
+ $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT
diff --git a/plugins/encodings/python/rost/Makefile.am b/plugins/encodings/python/rost/Makefile.am
index a5a2969..531fb26 100644
--- a/plugins/encodings/python/rost/Makefile.am
+++ b/plugins/encodings/python/rost/Makefile.am
@@ -5,7 +5,8 @@ libencodingspythonrost_la_SOURCES = \
base64.h base64.c \
module.h module.c
-libencodingspythonrost_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
+libencodingspythonrost_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) \
+ $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT