Avoid overflow in EVP_EncodeUpdate 91/133391/1
authorjaekuk, lee <juku1999@samsung.com>
Mon, 12 Jun 2017 04:34:26 +0000 (13:34 +0900)
committerjaekuk, lee <juku1999@samsung.com>
Mon, 12 Jun 2017 04:34:26 +0000 (13:34 +0900)
Change-Id: Ie90201c3ac5c6203583620c5843d2cd896a69955
Signed-off-by: jaekuk, lee <juku1999@samsung.com>
deps/openssl/openssl/crypto/evp/encode.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index c6abc4a..a5d0c65
@@ -157,7 +157,7 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
     if (inl <= 0)
         return;
     OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data));
-    if ((ctx->num + inl) < ctx->length) {
+    if (ctx->length - ctx->num > inl) {
         memcpy(&(ctx->enc_data[ctx->num]), in, inl);
         ctx->num += inl;
         return;