mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-27 11:52:34 -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
076655e18d
commit
997c99df9c
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