diff options
author | Michael Yakubovich <e_zine99@yahoo.com> | 2011-05-16 16:09:35 -0400 |
---|---|---|
committer | Michael Yakubovich <e_zine99@yahoo.com> | 2011-05-16 16:09:35 -0400 |
commit | a3707a10529c3d90a06149cf0e4bcd28b7b1ab5b (patch) | |
tree | dcb864405fda3669e2b3ca5cd168042571ed1f63 /src/or/connection.c | |
parent | e908e3a332dd469af2facac0846d0dc8349a30d3 (diff) | |
download | tor-a3707a10529c3d90a06149cf0e4bcd28b7b1ab5b.tar.gz tor-a3707a10529c3d90a06149cf0e4bcd28b7b1ab5b.zip |
Fix bug2752 : 48-char HTTPProxyAuthenticator limitation
Bumped the char maximum to 512 for HTTPProxyAuthenticator &
HTTPSProxyAuthenticator. Now stripping all '\n' after base64
encoding in alloc_http_authenticator.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 5054909df9..bcdde67568 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -3232,8 +3232,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; } |