diff options
author | David Benjamin <davidben@chromium.org> | 2015-03-20 00:42:08 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-03-20 00:59:28 +0300 |
commit | 642f1498d056dbba3e50ed5a232ab2f482626dec (patch) | |
tree | 80153749d39bf4d749180796c0346253e777a3da /crypto/base64 | |
parent | 7061e28dc203a6451e7a9bb2dce39f2751bcf7b3 (diff) |
evp: prevent underflow in base64 decoding
This patch resolves RT ticket #2608.
(Imported from upstream's d0666f289ac013094bbbf547bfbcd616199b7d2d.)
Change-Id: If0c8f583f3f643f3db6b6158cbc9ad7541bab8ec
Reviewed-on: https://boringssl-review.googlesource.com/4060
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/base64')
-rw-r--r-- | crypto/base64/base64.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/base64/base64.c b/crypto/base64/base64.c index 12a52cfd..4822fb89 100644 --- a/crypto/base64/base64.c +++ b/crypto/base64/base64.c @@ -373,6 +373,10 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, uint8_t *out, int *out_len, rv = 0; goto end; } + if (eof > v) { + rv = -1; + goto end; + } ret += (v - eof); } else { eof = 1; |