enc: fix coverity 1451499, 1451501, 1451506, 1451507, 1351511, 1451514, 1451517,...
[openssl.git] / crypto / modes / ofb128.c
index 829d724e2ae1e2426f8bedb6cb7c1fb6188b5508..0b213802083a3dc988ea5ba8a74e9e999cd4fd0d 100644 (file)
@@ -29,6 +29,11 @@ void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
     unsigned int n;
     size_t l = 0;
 
+    if (*num < 0) {
+        /* There is no good way to signal an error return from here */
+        *num = -1;
+        return;
+    }
     n = *num;
 
 #if !defined(OPENSSL_SMALL_FOOTPRINT)