Make sure we handle input NULL with length 0
[openssl.git] / providers / common / ciphers / cipher_common.c
index 8f39a168c8536c91f4c383fd7530186b2b98d222..83c370793bf20ecbdd713a0cff9eff32bb926465 100644 (file)
@@ -291,6 +291,11 @@ int cipher_generic_stream_update(void *vctx, unsigned char *out, size_t *outl,
 {
     PROV_CIPHER_CTX *ctx = (PROV_CIPHER_CTX *)vctx;
 
+    if (inl == 0) {
+        *outl = 0;
+        return 1;
+    }
+
     if (outsize < inl) {
         ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
         return 0;