aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-07-14 10:26:23 +0200
committerDavid Robillard <d@drobilla.net>2018-07-14 10:26:23 +0200
commit88ac6c757f5a40a604c14775cf11552fa657f0ad (patch)
tree875ac9b954b48750b2548e625b33588883e99643 /src
parent7e10a58373dbbb850c4f4daeb90ce2d9739da441 (diff)
downloadserd-88ac6c757f5a40a604c14775cf11552fa657f0ad.tar.gz
serd-88ac6c757f5a40a604c14775cf11552fa657f0ad.tar.bz2
serd-88ac6c757f5a40a604c14775cf11552fa657f0ad.zip
Fix length of base64 encoded nodes
Diffstat (limited to 'src')
-rw-r--r--src/node.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node.c b/src/node.c
index d3136575..655da1d1 100644
--- a/src/node.c
+++ b/src/node.c
@@ -359,7 +359,7 @@ encode_chunk(uint8_t out[4], const uint8_t in[3], size_t n_in)
SerdNode
serd_node_new_blob(const void* buf, size_t size, bool wrap_lines)
{
- const size_t len = ((size + 2) / 3) * 4 + (wrap_lines ? (size / 57) : 0);
+ const size_t len = (size + 2) / 3 * 4 + (wrap_lines * ((size - 1) / 57));
uint8_t* str = (uint8_t*)calloc(1, len + 2);
SerdNode node = { str, len, len, 0, SERD_LITERAL };
for (size_t i = 0, j = 0; i < size; i += 3, j += 4) {