Ebtables: communication.c retrieve_from_file 627 :Out of memory. (patch included)

Vlad Tautu <tvlad01-/[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel,gmane.linux.network.bridge.ebtables.user
Message-ID <[email protected]>
HI,
  I had a hard time to send this email, sourceforge is
giving a lot of errors...
 
   Whenever I try to use an --atomic-init and then to
append rules to the atomic file, I get the out of
memory error. For instance, the following command list
produces the error:
 
[root@bridge-2 root]# ebtables --atomic-file qwe
--atomic-init
[root@bridge-2 root]# ebtables --atomic-file qwe -A
FORWARD -p 0x806 --arp-ip-src 10.0.0.1 -j ACCEPT
[root@bridge-2 root]# ebtables --atomic-file qwe -A
FORWARD -p 0x806 --arp-ip-dst 10.0.0.1 -j ACCEPT

Ebtables: communication.c retrieve_from_file 627 :Out
of memory.
[root@bridge-2 root]# 
 
   There is aparently an memory miss-alocation error
in communication.c file of the ebtables userspace
program.
 
The code looks like:
====== line 623 - ebtables 2.0.5
 
        if (repl->nentries) {
                counters = (struct ebt_counter *)
                   malloc(repl->nentries *
sizeof(struct ebt_counter));
                if (!repl->counters)
                        print_memory();

=============
aparently the repl->counters also needs to be
malloc()ed for the program to work properly.
This is the piece of code to replace it with.
 
        if (repl->nentries) {
                repl->counters = (struct ebt_counter
*)
                   malloc(repl->nentries *
sizeof(struct ebt_counter));
                counters = (struct ebt_counter *)
                   malloc(repl->nentries *
sizeof(struct ebt_counter));
                if (!repl->counters)
                        print_memory();

 
Everything works fine with it changed. I am not sure
if there are memory leaks out of this patch, maybe you
can tell.
 
Thanks,
 Vlad.
 

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.