summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2015-07-27 12:58:40 +0000
committerYawning Angel <yawning@schwanenlied.me>2015-07-27 12:58:40 +0000
commitda6aa7bfa5014b980a93b38024d16b32720dc67a (patch)
treee52002264a73a0c7292f4bdf5203507efd26b795 /src/common
parent5be36a46cab7626c52e0c50e55ca73703698e399 (diff)
downloadtor-da6aa7bfa5014b980a93b38024d16b32720dc67a.tar.gz
tor-da6aa7bfa5014b980a93b38024d16b32720dc67a.zip
Allow a single trailing `.` when validating FQDNs from SOCKS.
URI syntax (and DNS syntax) allows for a single trailing `.` to explicitly distinguish between a relative and absolute (fully-qualified) domain name. While this is redundant in that RFC 1928 DOMAINNAME addresses are *always* fully-qualified, certain clients blindly pass the trailing `.` along in the request. Fixes bug 16674; bugfix on 0.2.6.2-alpha.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 618e6a1b6a..1aac4fc3d1 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1056,6 +1056,12 @@ string_is_valid_hostname(const char *string)
break;
}
+ /* Allow a single terminating '.' used rarely to indicate domains
+ * are FQDNs rather than relative. */
+ if ((c_sl_idx > 0) && (c_sl_idx + 1 == c_sl_len) && !*c) {
+ continue;
+ }
+
do {
if ((*c >= 'a' && *c <= 'z') ||
(*c >= 'A' && *c <= 'Z') ||