summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-08-20 20:05:56 +0000
committerRoger Dingledine <arma@torproject.org>2007-08-20 20:05:56 +0000
commit05f12bffe994ebae05778a4c269bfdd24065f423 (patch)
treefa3a9360f47d18085f68e12f152ec2ed0b2baaa0
parent4ff3343e9851abc07983a8038b1f8045351d7a38 (diff)
downloadtor-05f12bffe994ebae05778a4c269bfdd24065f423.tar.gz
tor-05f12bffe994ebae05778a4c269bfdd24065f423.zip
Handle unexpected whitespace better in malformed descriptors. Bug
found using Benedikt Boss's new Tor fuzzer! Bugfix on 0.2.0.x. svn:r11229
-rw-r--r--ChangeLog4
-rw-r--r--src/common/util.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 219744474e..1ee6eb4e95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
diff --git a/src/common/util.c b/src/common/util.c
index 81ba00b2bf..87af9556c0 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -534,12 +534,12 @@ eat_whitespace_eos(const char *s, const char *eos)
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 @@ eat_whitespace_no_nl(const char *s)
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;
}