apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Tuttle <ntut...@opendemand.com>
Subject Patches for bug found in APR sockets
Date Mon, 24 Nov 2003 14:48:33 GMT
  Attached are the diffs to the three operating system files for 
apr_socket_connect() within sockets.c
Good idea to make sure these work within Unix & OS2 environment; I 
compiled under Win32.
The patch should address the issue below.

-Norman Tuttle, developer, OpenDemand Systems, ntuttle@opendemand.com

Norman Tuttle wrote:

> While trying to memory-tune code which we are working on based on 
> Apache Flood, an apr project, I noticed some potentially memory-leak 
> prone code. While alloc_socket() called by apr_socket_create() does an 
> apr_palloc() to allocate memory for a socket's remote_addr member, the 
> apr_socket_connect() function sets the remote_addr directly to the 
> apr_sockaddr_t * which it passes. The problem is that that defeats the 
> purpose of allocating a buffer for it, since you're replacing with a 
> new pointer which presumably also had to allocate its space (and the 
> typical apr_socket_addr_get() would do that). So we need to use a 
> memcpy() instead!
> -Norman Tuttle, developer, OpenDemand Systems, ntuttle@opendemand.com
> PS Question: how many similar issues exist in the current state of the 
> APR?

View raw message