Skip to content

Commit 16648e7

Browse files
committed
add a trailing null char to the encoded string after base64'ing it
1 parent d09cae6 commit 16648e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tempodb/base64.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ char *encode_base64(int size, unsigned char *src) {
6060
if(!size)
6161
size= strlen((char *)src);
6262

63-
out= malloc(sizeof(char) * size*4/3+4);
63+
out= malloc(sizeof(char) * size*4/3+4 + 1);
6464

6565
p= out;
6666

@@ -97,6 +97,7 @@ char *encode_base64(int size, unsigned char *src) {
9797
}
9898

9999
}
100+
*p++ = '\0';
100101

101102
return out;
102103

0 commit comments

Comments
 (0)