Prevent signed integer overflow in CSR parsing
Modify the function mbedtls_x509_csr_parse_der() so that it checks the
parsed CSR version integer before it increments the value. This prevents
a potential signed integer overflow, as these have undefined behaviour
in the C standard.
diff --git a/ChangeLog b/ChangeLog
index 8e9d174..42a74e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,10 @@
Reported and fix suggested by guidovranken in #740
* Fix conditional preprocessor directives in bignum.h to enable 64-bit
compilation when using ARM Compiler 6.
+ * Fix potential integer overflow in the version verification for DER
+ encoded X509 CSRs. The overflow would enable maliciously constructed CSRs
+ to bypass the version verification check. Found by Peng Li/Yueh-Hsun Lin,
+ KNOX Security, Samsung Research America
Changes
* Added config.h option MBEDTLS_NO_UDBL_DIVISION, to prevent the use of