summaryrefslogtreecommitdiffstats
path: root/socks.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-11-18 22:17:58 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-11-18 22:17:58 +0100
commit529df9922d85574828d95020eebcd228ba3a8164 (patch)
tree8524b46dd4bbbd163d4ce273ea6e82edd7c4b947 /socks.c
parenteb208d36d466a1725e20e0a7aef39b1114b99e78 (diff)
parent7c18c6353904f8c6e7f4eab3d13c985761ab80e5 (diff)
downloadopenvpn-529df9922d85574828d95020eebcd228ba3a8164.tar.gz
openvpn-529df9922d85574828d95020eebcd228ba3a8164.tar.xz
openvpn-529df9922d85574828d95020eebcd228ba3a8164.zip
Merge branch 'feat_misc' into beta2.2
Conflicts: acinclude.m4 config-win32.h configure.ac misc.c thread.c thread.h - These conflicts was mainly due to feat_misc getting old and mostly caused by the pthread clean-up patches in feat_misc Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'socks.c')
-rw-r--r--socks.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/socks.c b/socks.c
index 7c9edd1..1848f08 100644
--- a/socks.c
+++ b/socks.c
@@ -112,10 +112,17 @@ socks_username_password_auth (struct socks_proxy_info *p,
ssize_t size;
creds.defined = 0;
-
get_user_pass (&creds, p->authfile, UP_TYPE_SOCKS, GET_USER_PASS_MANAGEMENT);
- snprintf (to_send, sizeof (to_send), "\x01%c%s%c%s", strlen(creds.username),
- creds.username, strlen(creds.password), creds.password);
+
+ if( !creds.username || (strlen(creds.username) > 255)
+ || !creds.password || (strlen(creds.password) > 255) ) {
+ msg (M_NONFATAL,
+ "SOCKS username and/or password exceeds 255 characters. "
+ "Authentication not possible.");
+ return false;
+ }
+ snprintf (to_send, sizeof (to_send), "\x01%c%s%c%s", (int) strlen(creds.username),
+ creds.username, (int) strlen(creds.password), creds.password);
size = send (sd, to_send, strlen(to_send), MSG_NOSIGNAL);
if (size != strlen (to_send))