diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-17 19:53:06 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-17 19:53:06 -0400 |
commit | c240efab86d71d8953a36e0599bfc789ee980b71 (patch) | |
tree | 3e17f14ae221d0fa2da852037b91eace6bd35d33 /src | |
parent | e0e8424f1eaf88f1c03a0acbfe09d368d3cbb1be (diff) | |
parent | bc89ef0ca8164f9e6e23e73c01bdb4257fdbce7c (diff) | |
download | tor-c240efab86d71d8953a36e0599bfc789ee980b71.tar.gz tor-c240efab86d71d8953a36e0599bfc789ee980b71.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 8 | ||||
-rw-r--r-- | src/or/connection.c | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/or/config.c b/src/or/config.c index 78cc4772e9..87eb5d38ea 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3481,8 +3481,8 @@ options_validate(or_options_t *old_options, or_options_t *options, } if (options->HTTPProxyAuthenticator) { - if (strlen(options->HTTPProxyAuthenticator) >= 48) - REJECT("HTTPProxyAuthenticator is too long (>= 48 chars)."); + if (strlen(options->HTTPProxyAuthenticator) >= 512) + REJECT("HTTPProxyAuthenticator is too long (>= 512 chars)."); } if (options->HTTPSProxy) { /* parse it now */ @@ -3495,8 +3495,8 @@ options_validate(or_options_t *old_options, or_options_t *options, } if (options->HTTPSProxyAuthenticator) { - if (strlen(options->HTTPSProxyAuthenticator) >= 48) - REJECT("HTTPSProxyAuthenticator is too long (>= 48 chars)."); + if (strlen(options->HTTPSProxyAuthenticator) >= 512) + REJECT("HTTPSProxyAuthenticator is too long (>= 512 chars)."); } if (options->Socks4Proxy) { /* parse it now */ diff --git a/src/or/connection.c b/src/or/connection.c index 50acec32a3..4877a3cbf4 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -3645,8 +3645,17 @@ alloc_http_authenticator(const char *authenticator) authenticator, authenticator_length) < 0) { tor_free(base64_authenticator); /* free and set to null */ } else { - /* remove extra \n at end of encoding */ - base64_authenticator[strlen(base64_authenticator) - 1] = 0; + int i = 0, j = 0; + int len = strlen(base64_authenticator); + + /* remove all newline occurrences within the string */ + for (i=0; i < len; ++i) { + if ('\n' != base64_authenticator[i]) { + base64_authenticator[j] = base64_authenticator[i]; + ++j; + } + } + base64_authenticator[j]='\0'; } return base64_authenticator; } |