mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-28 04:12:17 -04:00
BUG/MINOR: base64: return empty string for empty input in base64dec()
Right now no special case is made of size zero and the parser assumes that it can read the last two chars, which do not exist in this case. Let's check for this empty string situation and return zero (empty) as well. This should be backported to all versions.
This commit is contained in:
parent
6eefa71ac0
commit
38c2a62d5a
1 changed files with 3 additions and 0 deletions
|
|
@ -125,6 +125,9 @@ int base64dec(const char *in, size_t ilen, char *out, size_t olen) {
|
|||
signed char b;
|
||||
int convlen = 0, i = 0, pad = 0;
|
||||
|
||||
if (!ilen)
|
||||
return 0;
|
||||
|
||||
if (ilen % 4)
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue