aboutsummaryrefslogtreecommitdiff
path: root/crypto/bio
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-02-10 05:12:52 +0100
committerRichard Levitte <levitte@openssl.org>2016-02-10 05:12:52 +0100
commitd40cf9bc9c0913310ef2232b13d8e15e73e9d2b4 (patch)
tree24a8eb7846e1fb9a7360b4ed5bd41802f0fd884a /crypto/bio
parente8461ee1d17d64dddcdedf133c7f47ab4ac15ff2 (diff)
downloadopenssl-d40cf9bc9c0913310ef2232b13d8e15e73e9d2b4.zip
openssl-d40cf9bc9c0913310ef2232b13d8e15e73e9d2b4.tar.gz
openssl-d40cf9bc9c0913310ef2232b13d8e15e73e9d2b4.tar.bz2
VMS getnameinfo() seems to have a bug with returned service string
It seems like it gives back gibberish. If we asked for a numeric service, it's easy to check for a digit in the first position, and if there isn't any, rewrite it using older methods. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_addr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index b60d6ac..9131dcd 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -58,6 +58,7 @@
#include <openssl/err.h>
#include <openssl/buffer.h>
+#include <ctype.h>
/*
* Throughout this file and bio_lcl.h, the existence of the macro
@@ -250,6 +251,16 @@ static int addr_strings(const BIO_ADDR *ap, int numeric,
}
return 0;
}
+
+ /* VMS getnameinfo() seems to have a bug, where serv gets filled
+ * with gibberish. We can at least check for digits when flags
+ * has NI_NUMERICSERV enabled
+ */
+ if ((flags & NI_NUMERICSERV) != 0 && !isdigit(serv[0])) {
+ BIO_snprintf(serv, sizeof(serv), "%d",
+ ntohs(BIO_ADDR_rawport(ap)));
+ }
+
if (hostname)
*hostname = OPENSSL_strdup(host);
if (service)