]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Check for len < 4 in dn_indicates_v3_cert
authorNick Mathewson <nickm@torproject.org>
Wed, 21 Oct 2015 15:44:43 +0000 (11:44 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 21 Oct 2015 15:44:43 +0000 (11:44 -0400)
Without this check, we potentially look up to 3 characters before
the start of a malloc'd segment, which could provoke a crash under
certain (weird afaik) circumstances.

Fixes 17404; bugfix on 0.2.6.3-alpha.

changes/bug17404 [new file with mode: 0644]
src/common/tortls.c

diff --git a/changes/bug17404 b/changes/bug17404
new file mode 100644 (file)
index 0000000..d524f66
--- /dev/null
@@ -0,0 +1,6 @@
+  o Major bugfixes (security, correctness):
+    - Fix a programming error that could cause us to read 4 bytes before
+      the beginning of an openssl string. This could be used to provoke
+      a crash on systems with an unusual malloc implementation, or
+      systems with unsual hardening installed. Fixes bug 17404; bugfix
+      on 0.2.3.6-alpha.
index 4222f6dbffa597559c737e7b230afa17e2d75d8f..75ca47dbdb5d92d5f6ed598635498515c2888c79 100644 (file)
@@ -2676,6 +2676,10 @@ dn_indicates_v3_cert(X509_NAME *name)
   len = ASN1_STRING_to_UTF8(&s, str);
   if (len < 0)
     return 0;
+  if (len < 4) {
+    OPENSSL_free(s);
+    return 0;
+  }
   r = fast_memneq(s + len - 4, ".net", 4);
   OPENSSL_free(s);
   return r;