* [PATCH] fix getservby*_r result pointer value on error
@ 2016-09-24 1:10 Daniel Sabogal
2016-09-24 5:10 ` Rich Felker
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Sabogal @ 2016-09-24 1:10 UTC (permalink / raw)
To: musl
this is a clone of the fix to the gethostby*_r functions in
commit fe82bb9b921be34370e6b71a1c6f062c20999ae0. the man pages
document that the getservby*_r functions set this pointer to
NULL if there was an error or if no record was found.
---
src/network/getservbyname_r.c | 2 ++
src/network/getservbyport_r.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/network/getservbyname_r.c b/src/network/getservbyname_r.c
index 056c2f3..ad3d616 100644
--- a/src/network/getservbyname_r.c
+++ b/src/network/getservbyname_r.c
@@ -15,6 +15,8 @@ int getservbyname_r(const char *name, const char *prots,
struct service servs[MAXSERVS];
int cnt, proto, align;
+ *res = 0;
+
/* Align buffer */
align = -(uintptr_t)buf & ALIGN-1;
if (buflen < 2*sizeof(char *)+align)
diff --git a/src/network/getservbyport_r.c b/src/network/getservbyport_r.c
index a0a7cae..0ae0e41 100644
--- a/src/network/getservbyport_r.c
+++ b/src/network/getservbyport_r.c
@@ -20,6 +20,7 @@ int getservbyport_r(int port, const char *prots,
if (r) r = getservbyport_r(port, "udp", se, buf, buflen, res);
return r;
}
+ *res = 0;
/* Align buffer */
i = (uintptr_t)buf & sizeof(char *)-1;
--
2.10.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fix getservby*_r result pointer value on error
2016-09-24 1:10 [PATCH] fix getservby*_r result pointer value on error Daniel Sabogal
@ 2016-09-24 5:10 ` Rich Felker
0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2016-09-24 5:10 UTC (permalink / raw)
To: musl
On Fri, Sep 23, 2016 at 09:10:07PM -0400, Daniel Sabogal wrote:
> this is a clone of the fix to the gethostby*_r functions in
> commit fe82bb9b921be34370e6b71a1c6f062c20999ae0. the man pages
> document that the getservby*_r functions set this pointer to
> NULL if there was an error or if no record was found.
> ---
> src/network/getservbyname_r.c | 2 ++
> src/network/getservbyport_r.c | 1 +
> 2 files changed, 3 insertions(+)
Applied -- thanks.
Rich
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-24 5:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-24 1:10 [PATCH] fix getservby*_r result pointer value on error Daniel Sabogal
2016-09-24 5:10 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).