> -----Original Message-----
> From: Kieran [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 21, 2002 6:02 AM
> To: [EMAIL PROTECTED]
> Subject: Possible race condition in gwlib/protected.c
> 
> 
> Hi,
> 
> I'm feeling my way into the kannel source, and I think I've identified
> a race condition in the gw_gethostbyname() function in 
> gwlib/protected.c
> In particular, the gethostbyname function call returns some 
> static data.
> 
> I've rolled patch to fix this, noting that:
> 1. The only callers in the of gw_gethostbyname in tree 
> currently are in
>    gwlib/socket.c
> 2. Those callers only use the hostent.h_name and 
> hostent.h_addr_list[0]
>    fields in the struct hostent.
> 3. I've been careful to free the memory allocated as close to the call
>    to gw_gethostbyname() as possible.
> 
> The patch thus copies mallocs space for these fields, and copies the
> relevant data, and then frees it.

Nice catch. I like the patch too, and will vote for it if you stop using 
gw_native_malloc() and call the macro wrapper instead. some of us are using checking 
or even slow malloc from time to time, and its such a waste having a memory allocation 
checker and then opting out of using it.

--
Oded Arbel
m-Wise mobile solutions
[EMAIL PROTECTED]

+972-9-9581711 (116)
+972-67-340014

::..
"I'm all for computer dating, but I wouldn't want one to marry my sister."

Reply via email to