aboutsummaryrefslogtreecommitdiff
path: root/src/util/socks.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/socks.c')
-rw-r--r--src/util/socks.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/util/socks.c b/src/util/socks.c
index 7eca04878..9e974e6bb 100644
--- a/src/util/socks.c
+++ b/src/util/socks.c
@@ -76,7 +76,7 @@ const char * SOCKS5_REP_names(int rep)
76 76
77/** 77/**
78 * Encode a string for the SOCKS5 protocol by prefixing it a byte stating its 78 * Encode a string for the SOCKS5 protocol by prefixing it a byte stating its
79 * length and stipping the trailing zero byte. Truncates any string longer 79 * length and stripping the trailing zero byte. Truncates any string longer
80 * than 255 bytes. 80 * than 255 bytes.
81 * 81 *
82 * @param b buffer to contain the encoded string 82 * @param b buffer to contain the encoded string
@@ -96,7 +96,10 @@ SOCK5_proto_string(unsigned char * b,
96 l=255; 96 l=255;
97 } 97 }
98 *(b++) = (unsigned char) l; 98 *(b++) = (unsigned char) l;
99 strncpy ((char *)b, s, l); 99 /*
100 * intentionally use strncpy (trailing zero byte must be stripped in b)
101 */
102 strncpy ((char*)b, s, l);
100 return b+l; 103 return b+l;
101} 104}
102 105
@@ -489,7 +492,7 @@ GNUNET_SOCKS_init_handshake_noauth ()
489 */ 492 */
490void 493void
491GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih, 494GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih,
492 const char *host, uint16_t port) 495 const char *host, uint16_t port)
493{ 496{
494 union { 497 union {
495 struct in_addr in4; 498 struct in_addr in4;