Skip to content

Commit 9eec52f

Browse files
changed math operation to be slower but removed chance of interger overflow
1 parent e3d8ab6 commit 9eec52f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/tools/clu_base64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int wolfCLU_Base64Setup(int argc, char** argv)
199199
else {
200200
/* For regular base64 decoding */
201201
/* Calculate output size */
202-
outputSz = (inputSz * 3) / 4 + 1;
202+
outputSz = (inputSz / 4) * 3 + (inputSz % 4) * 3 / 4 + 1;
203203

204204
/* Allocate output buffer */
205205
output = (byte*)XMALLOC(outputSz, HEAP_HINT,

0 commit comments

Comments
 (0)