about summary refs log tree commit diff
path: root/src/network
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-08-01 00:11:25 -0400
committerRich Felker <dalias@aerifal.cx>2011-08-01 00:11:25 -0400
commitf4e8e64b82a85158d9de884e1765474c0c317d19 (patch)
tree8d4f8c6c7857bd688c45d703dbdeed521e5af44e /src/network
parente95b0a9d1077b3d20d1b6efebe5135eb99a8b7ef (diff)
downloadmusl-f4e8e64b82a85158d9de884e1765474c0c317d19.tar.gz
musl-f4e8e64b82a85158d9de884e1765474c0c317d19.tar.xz
musl-f4e8e64b82a85158d9de884e1765474c0c317d19.zip
port numbers should always be interpreted as decimal
per POSIX and RFC 3493:

If the specified address family is AF_INET, AF_INET6, or AF_UNSPEC,
the service can be specified as a string specifying a decimal port
number.

021 is a valid decimal number, therefore, interpreting it as octal
seems to be non-conformant.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/getaddrinfo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
index 494b412a..e5fa5191 100644
--- a/src/network/getaddrinfo.c
+++ b/src/network/getaddrinfo.c
@@ -76,7 +76,7 @@ int getaddrinfo(const char *host, const char *serv, const struct addrinfo *hint,
 
 	if (serv) {
 		if (!*serv) return EAI_SERVICE;
-		port = strtoul(serv, &z, 0);
+		port = strtoul(serv, &z, 10);
 		if (!*z && port > 65535) return EAI_SERVICE;
 		if (!port) {
 			if (flags & AI_NUMERICSERV) return EAI_SERVICE;