]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't use checked strl{cat,cpy} on OSX.
authorNick Mathewson <nickm@torproject.org>
Mon, 9 Mar 2015 19:09:49 +0000 (15:09 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 Mar 2015 19:09:49 +0000 (15:09 -0400)
There is a bug in the overlap-checking in strlcat that can crash Tor
servers.  Fixes bug 15205; this is an OSX bug, not a Tor bug.

changes/bug15205 [new file with mode: 0644]
src/common/compat.h

diff --git a/changes/bug15205 b/changes/bug15205
new file mode 100644 (file)
index 0000000..0cb9f3f
--- /dev/null
@@ -0,0 +1,5 @@
+  o Major bugfixes (crash, OSX, security):
+    - Fix a remote denial-of-service opportunity caused by a bug
+      in OSX's _strlcat_chk() function. Fixes bug 15205; bug first
+      appeared in OSX 10.9. 
+      
index ec7d2415edc60dab1c1aecbd647e0ea9719db167..531e88f1bd35b4e7ed243111cce55b6b4137bfa9 100644 (file)
@@ -224,6 +224,18 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
 #define strncasecmp _strnicmp
 #define strcasecmp _stricmp
 #endif
+
+#if defined __APPLE__
+/* On OSX 10.9 and later, the overlap-checking code for strlcat would
+ * appear to have a severe bug that can sometimes cause aborts in Tor.
+ * Instead, use the non-checking variants.  This is sad.
+ *
+ * See https://trac.torproject.org/projects/tor/ticket/15205
+ */
+#undef strlcat
+#undef strlcpy
+#endif
+
 #ifndef HAVE_STRLCAT
 size_t strlcat(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
 #endif