Skip to content

Commit

Permalink
Update base64.h
Browse files Browse the repository at this point in the history
修复当输入in是不完整base64编码时,且长度不是4的倍数,会导致解码输出数据多一个字节,超出out缓冲区,出现内存溢出的行为。
  • Loading branch information
youye521 authored Nov 16, 2024
1 parent 92d5465 commit a1216a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "hexport.h"

#define BASE64_ENCODE_OUT_SIZE(s) (((s) + 2) / 3 * 4)
#define BASE64_DECODE_OUT_SIZE(s) (((s)) / 4 * 3)
#define BASE64_DECODE_OUT_SIZE(s) (((s) + 3) / 4 * 3)

BEGIN_EXTERN_C

Expand Down

0 comments on commit a1216a1

Please sign in to comment.