[syslog-ng]Syslog-NG 1.6.6 memory leak when sending UDP logs

Balazs Scheidler syslog-ng@lists.balabit.hu
Sat, 05 Mar 2005 10:33:54 +0100


On Fri, 2005-03-04 at 13:56 -0500, henry@shoelacecity.com wrote:
> 
> >There is no version 1.2.2, the latest version is 1.1.2.1 (or 1.1.3
> which
> >is BETA)
> 
> My bad, (typo) 1.1.2(.1) to be specific.   

Thanks.


> >This patch fixes the byte order issue, and I'm still hunting the
> memory
> >leak with your configuration:
> >
> >diff -u -r1.25.4.6 afinet.c
> >--- afinet.c    5 Aug 2004 11:35:12 -0000       1.25.4.6
> >+++ afinet.c    3 Mar 2005 12:26:47 -0000
> >@@ -617,11 +617,10 @@
> >                        ADDRESS2SOCKADDR(msg->saddr,
> sizeof(src_addr), (struct sockaddr *) &src_addr);
> >                        ADDRESS2SOCKADDR(self->super.dest_addr,
> sizeof(dst_addr), (struct sockaddr *) >&dst_addr);
> >
> >-
> >                        libnet_clear_packet(self->lnet_ctx);
> >
> >-                       udp = libnet_build_udp(src_addr.sin_port,
> >-                                              dst_addr.sin_port,
> >+                       udp =
> libnet_build_udp(ntohs(src_addr.sin_port),
> >+
>  ntohs(dst_addr.sin_port),
> >                                               LIBNET_UDP_H +
> msg_line->length,
> >                                               0,
> >                                               msg_line->data,
> 
> I applied the patch, and recompiled. You are not going to beleive
> this: 
> Data is STILL getting to the destination properly - despite the ntohs
> function.  
> Yes, I  checked the binary to be certain it recompiled, and threw a
> printf statement in there to be certain.  
> It would seem that the ntohs function has no effect. 

I have the solution for this one. You are using port number 514, which
is 0x0202 which is 0x0202 even if you swap the bytes :) Try using a
different port number  and you'll see the problem with the unpatched
version.

-- 
Bazsi