diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c
index 57f0cee2..aff62746 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -381,7 +381,10 @@ recv_socks_reply(socket_descriptor_t sd,
                     break;
 
                 case '\x03':    /* DOMAINNAME */
-                    alen = (unsigned char) c;
+                    /* RFC 1928, section 5: 1 byte length, <n> bytes name,
+                     * so the total "address length" is (length+1)
+                     */
+                    alen = (unsigned char) c +1;
                     break;
 
                 case '\x04':    /* IP V6 */
