[or-cvs] r11229: Handle unexpected whitespace better in malformed descriptors (in tor/trunk: . src/common)

arma at seul.org arma at seul.org
Mon Aug 20 20:05:56 UTC 2007


Author: arma
Date: 2007-08-20 16:05:56 -0400 (Mon, 20 Aug 2007)
New Revision: 11229

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/util.c
Log:
Handle unexpected whitespace better in malformed descriptors. Bug
found using Benedikt Boss's new Tor fuzzer! Bugfix on 0.2.0.x.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-08-20 18:29:17 UTC (rev 11228)
+++ tor/trunk/ChangeLog	2007-08-20 20:05:56 UTC (rev 11229)
@@ -1,4 +1,8 @@
 Changes in version 0.2.0.6-alpha - 2007-??-??
+  o Major bugfixes:
+    - Handle unexpected whitespace better in malformed descriptors. Bug
+      found using Benedikt Boss's new Tor fuzzer! Bugfix on 0.2.0.x.
+
   o Minor bugfixes (bridges):
     - Do not intermix bridge routers with controller-added routers. (Bugfix
       on 0.2.0.x)

Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2007-08-20 18:29:17 UTC (rev 11228)
+++ tor/trunk/src/common/util.c	2007-08-20 20:05:56 UTC (rev 11229)
@@ -534,12 +534,12 @@
   return s;
 }
 
-/** Return a pointer to the first char of s that is not a space or a tab,
- * or to the terminating NUL if no such character exists. */
+/** Return a pointer to the first char of s that is not a space or a tab
+ * or a \\r, or to the terminating NUL if no such character exists. */
 const char *
 eat_whitespace_no_nl(const char *s)
 {
-  while (*s == ' ' || *s == '\t')
+  while (*s == ' ' || *s == '\t' || *s == '\r')
     ++s;
   return s;
 }
@@ -549,7 +549,7 @@
 const char *
 eat_whitespace_eos_no_nl(const char *s, const char *eos)
 {
-  while (s < eos && (*s == ' ' || *s == '\t'))
+  while (s < eos && (*s == ' ' || *s == '\t' || *s == '\r'))
     ++s;
   return s;
 }



More information about the tor-commits mailing list