Browse Source

Merge pull request #145 from libtom/fix/coverity-cbc_decrypt-out-of-bounds-read

fix coverity finding: cbc_decrypt out-of-bound read
karel-m 8 years ago
parent
commit
d777f9d1dc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/modes/cbc/cbc_decrypt.c

+ 1 - 1
src/modes/cbc/cbc_decrypt.c

@@ -45,7 +45,7 @@ int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
    }
    }
 
 
    /* is blocklen valid? */
    /* is blocklen valid? */
-   if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV)) {
+   if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV) || cbc->blocklen > (int)sizeof(tmp)) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
    }
    }