Mailing List Archive

patch for freshclam/manager.c (was: Re: daily.cvd?)
On Mon, Nov 10, 2003 at 10:02:54PM +0100, Tomasz Kojm wrote:
> I tested freshclam with several systems and can't reproduce that error:

The latest symptoms of the patch seem to not show up unless you
compile with 'gcc -Os' (gcc 3.3.2). To me, this was evidence that
memory was being over-written somewhere.

Taking a look at the source, I see that the downloaddb() function uses
the variable ipaddr as a sort of 'cached ip value'. It is read from
several places, although only initialized when downloaddb() is not passed
an ip address.

This patch initializes it always. A patch that would leave the code cleaner
might eliminate either ip or ipaddr from the reference below the line
patched, and use either all one, or all the other.

Cheers,
mark


--- freshclam/manager.c~ 2003-11-11 20:15:28.683590360 -0500
+++ freshclam/manager.c 2003-11-11 20:50:55.472269336 -0500
@@ -141,11 +141,11 @@
}
if(proxy)
mprintf("Connecting via %s\n", proxy);

if(ip[0])
- hostfd = wwwconnect(ip, proxy, NULL); /* we use ip to connect */
+ hostfd = wwwconnect(ip, proxy, ipaddr); /* we use ip to connect */
else
hostfd = wwwconnect(hostname, proxy, ipaddr);

if(hostfd < 0) {
mprintf("@Connection with %s (IP: %s) failed.\n", hostname, ipaddr);


--
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/
Re: patch for freshclam/manager.c (was: Re: daily.cvd?) [ In reply to ]
I guess this patch was too late for the release? :-)

Eh well, I'll just keep applying it locally. I use -Os to compile to
reduce the in-memory footprint of clamd. Daemons that run all the time
should be compiled with -Os more often to allow a few more blocks of
RAM / cache for demanding user applications like Mozilla...

Cheers,
mark


On Tue, Nov 11, 2003 at 08:56:27PM -0500, Mark Mielke wrote:
> On Mon, Nov 10, 2003 at 10:02:54PM +0100, Tomasz Kojm wrote:
> > I tested freshclam with several systems and can't reproduce that error:
>
> The latest symptoms of the patch seem to not show up unless you
> compile with 'gcc -Os' (gcc 3.3.2). To me, this was evidence that
> memory was being over-written somewhere.
>
> Taking a look at the source, I see that the downloaddb() function uses
> the variable ipaddr as a sort of 'cached ip value'. It is read from
> several places, although only initialized when downloaddb() is not passed
> an ip address.
>
> This patch initializes it always. A patch that would leave the code cleaner
> might eliminate either ip or ipaddr from the reference below the line
> patched, and use either all one, or all the other.
>
> Cheers,
> mark
>
>
> --- freshclam/manager.c~ 2003-11-11 20:15:28.683590360 -0500
> +++ freshclam/manager.c 2003-11-11 20:50:55.472269336 -0500
> @@ -141,11 +141,11 @@
> }
> if(proxy)
> mprintf("Connecting via %s\n", proxy);
>
> if(ip[0])
> - hostfd = wwwconnect(ip, proxy, NULL); /* we use ip to connect */
> + hostfd = wwwconnect(ip, proxy, ipaddr); /* we use ip to connect */
> else
> hostfd = wwwconnect(hostname, proxy, ipaddr);
>
> if(hostfd < 0) {
> mprintf("@Connection with %s (IP: %s) failed.\n", hostname, ipaddr);

--
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/
Re: patch for freshclam/manager.c (was: Re: [Clamav-devel] daily.cvd?) [ In reply to ]
On Wed, 12 Nov 2003 11:50:01 -0500
Mark Mielke <mark@mark.mielke.cc> wrote:

> I guess this patch was too late for the release? :-)

That's it :-( I had no time to check it and repeat the stress tests.

Best regards,
Tomasz Kojm
--
oo ..... tkojm@clamav.net www.ClamAV.net
(\/)\......... http://www.clamav.net/gpg/tkojm.gpg
\..........._ 0DCA5A08407D5288279DB43454822DC8985A444B
//\ /\ Thu Nov 13 04:45:44 CET 2003
Re: patch for freshclam/manager.c (was: Re: [Clamav-devel] daily.cvd?) [ In reply to ]
On Tue, 11 Nov 2003 20:56:27 -0500
Mark Mielke <mark@mark.mielke.cc> wrote:

> Taking a look at the source, I see that the downloaddb() function uses
> the variable ipaddr as a sort of 'cached ip value'. It is read from
> several places, although only initialized when downloaddb() is not
> passed an ip address.

> This patch initializes it always. A patch that would leave the code

Applied in CVS, thanks.

Best regards,
Tomasz Kojm
--
oo ..... tkojm@clamav.net www.ClamAV.net
(\/)\......... http://www.clamav.net/gpg/tkojm.gpg
\..........._ 0DCA5A08407D5288279DB43454822DC8985A444B
//\ /\ Sat Nov 15 01:13:57 CET 2003