diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-07-14 20:16:23 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-07-14 20:16:23 -0400 |
commit | 06650b968461b72d5eb44063dd68c176be330372 (patch) | |
tree | cb3bb5ea46b47d8cd87dbb730caa4711a815859e /src/network/getservbyport_r.c | |
parent | 7be3b5a073e77f1147acfa728725f9f81d20ceb0 (diff) | |
download | musl-06650b968461b72d5eb44063dd68c176be330372.tar.gz musl-06650b968461b72d5eb44063dd68c176be330372.tar.bz2 musl-06650b968461b72d5eb44063dd68c176be330372.tar.xz musl-06650b968461b72d5eb44063dd68c176be330372.zip |
fix getservby*() with null pointer for protocol argument
not sure this is the best fix but it should work
Diffstat (limited to 'src/network/getservbyport_r.c')
-rw-r--r-- | src/network/getservbyport_r.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c index f119abc8..821afae9 100644 --- a/src/network/getservbyport_r.c +++ b/src/network/getservbyport_r.c @@ -15,6 +15,10 @@ int getservbyport_r(int port, const char *prots, .sin_port = port, }; + if (!prots) return -( + getservbyport_r(port, "tcp", se, buf, buflen, res) + && getservbyport_r(port, "udp", se, buf, buflen, res) ); + /* Align buffer */ i = (uintptr_t)buf & sizeof(char *)-1; if (!i) i = sizeof(char *); |