From ddea87e913e6779399bdc8acef461afcb89e22ba Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 4 Apr 2025 21:32:18 +0800 Subject: [PATCH] Update base64.c --- src/modules/base64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/base64.c b/src/modules/base64.c index 9be57eec..bda91126 100644 --- a/src/modules/base64.c +++ b/src/modules/base64.c @@ -170,7 +170,7 @@ static bool base64_b64encode(int argc, py_Ref argv) { PY_CHECK_ARG_TYPE(0, tp_bytes); int src_size; unsigned char* src_data = py_tobytes(argv, &src_size); - unsigned char* dst_data = py_newbytes(py_retval(), src_size * 2); + unsigned char* dst_data = py_newbytes(py_retval(), src_size * 4 / 3 + 4); int size = base64_encode(src_data, src_size, (char*)dst_data); py_bytes_resize(py_retval(), size); return true;