tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getnameinfo() / getservent_r() windows



On Tue, Aug 11, 2009 at 08:19:22PM +0000, Christos Zoulas wrote:
> In article <20090811172651.GC643094%qnx.com@localhost>,
> Sean Boudreau  <seanb%qnx.com@localhost> wrote:
> >-=-=-=-=-=-
> >
> >
> >There's a section in getnameinfo() where the results
> >of a getservbyport_r() are referenced after a 
> >endservent_r() which invalidates it.
> >
> >There's also a couple of sections in the getservent_r()
> >handling where a buffer that may not have been malloc()'d
> >is free()'d
> >
> >Any concerns before I commit?
> 
> go for it.

Done, although the non malloc()'d part was bogus (confusing
fgetln() and fparseln()).

I checked getaddrinfo() for the same thing.  It used to
be there but there's been a lot of reorg to leverage
_SV_STAYOPEN but I can't see where that's actually being
set.  Was the following the intention?

-seanb
Index: getaddrinfo.c
===================================================================
RCS file: /cvsroot/src/lib/libc/net/getaddrinfo.c,v
retrieving revision 1.92
diff -u -r1.92 getaddrinfo.c
--- getaddrinfo.c       23 Jan 2009 00:48:57 -0000      1.92
+++ getaddrinfo.c       12 Aug 2009 20:27:45 -0000
@@ -951,6 +951,7 @@
                        break;
                }
 
+               setservent_r(1, svd);   /* stayopen */
                sp = getservbyname_r(servname, proto, &sv, svd);
                if (sp == NULL)
                        return EAI_SERVICE;


Home | Main Index | Thread Index | Old Index