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

syslog-ng@lists.balabit.hu syslog-ng@lists.balabit.hu
Fri, 4 Mar 2005 13:56:32 -0500


This is a multipart message in MIME format.
--=_alternative 006866A385256FBA_=
Content-Type: text/plain; charset="US-ASCII"

>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. 


>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. 


--=_alternative 006866A385256FBA_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2><tt>&gt;There is no version 1.2.2, the latest version
is 1.1.2.1 (or 1.1.3 which<br>
&gt;is BETA)<br>
</tt></font>
<br><font size=2><tt>My bad, (typo) 1.1.2(.1) to be specific. &nbsp;</tt></font>
<br>
<br><font size=2><tt><br>
&gt;This patch fixes the byte order issue, and I'm still hunting the memory<br>
&gt;leak with your configuration:<br>
&gt;<br>
&gt;diff -u -r1.25.4.6 afinet.c<br>
&gt;--- afinet.c &nbsp; &nbsp;5 Aug 2004 11:35:12 -0000 &nbsp; &nbsp; &nbsp;
1.25.4.6<br>
&gt;+++ afinet.c &nbsp; &nbsp;3 Mar 2005 12:26:47 -0000<br>
&gt;@@ -617,11 +617,10 @@<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;ADDRESS2SOCKADDR(msg-&gt;saddr, sizeof(src_addr), (struct
sockaddr *) &amp;src_addr);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;ADDRESS2SOCKADDR(self-&gt;super.dest_addr, sizeof(dst_addr),
(struct sockaddr *) &gt;&amp;dst_addr);<br>
&gt;<br>
&gt;-<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;libnet_clear_packet(self-&gt;lnet_ctx);<br>
&gt;<br>
&gt;- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; udp = libnet_build_udp(src_addr.sin_port,<br>
&gt;- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;dst_addr.sin_port,<br>
&gt;+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; udp = libnet_build_udp(ntohs(src_addr.sin_port),<br>
&gt;+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;ntohs(dst_addr.sin_port),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; LIBNET_UDP_H + msg_line-&gt;length,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; 0,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; msg_line-&gt;data,<br>
<br>
I applied the patch, and recompiled. You are not going to beleive this:</tt></font>
<br><font size=2><tt>Data is STILL getting to the destination properly
- despite the ntohs function. </tt></font>
<br><font size=2><tt>Yes, I &nbsp;checked the binary to be certain it recompiled,
and threw a printf statement in there to be certain. </tt></font>
<br><font size=2><tt>It would seem that the ntohs function has no effect.
</tt></font>
<br>
<br>
--=_alternative 006866A385256FBA_=--