mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MINOR: base64: dec func ignores padding for output size checking
Decode function returns an error even if the ouptut buffer is large enought because the padding was not considered. This case was never met with current code base.
This commit is contained in:
parent
32d75ed300
commit
ed697e4856
@ -83,7 +83,9 @@ int base64dec(const char *in, size_t ilen, char *out, size_t olen) {
|
||||
if (ilen % 4)
|
||||
return -1;
|
||||
|
||||
if (olen < ilen / 4 * 3)
|
||||
if (olen < ((ilen / 4 * 3)
|
||||
- (in[ilen-1] == '=' ? 1 : 0)
|
||||
- (in[ilen-2] == '=' ? 1 : 0)))
|
||||
return -2;
|
||||
|
||||
while (ilen) {
|
||||
|
Loading…
Reference in New Issue
Block a user