Re: [pmacct-discussion] uninitialized req passed to plugin_requests and load_id_file in pm_pcap_cb??
Hi Mikhail, I see, yes. The reason nothing happens (not out of coincidences :-)) is that all the reads are checking whether we are in the context of a tee plugin (which does not apply to pmacctd / uacctd). But i agree with you: that is recipe for potential disaster so i committed a memset() there: https://github.com/pmacct/pmacct/commit/ff77d4ba58c5e11205577dff32fe1696bfca360d Thanks very much for your input! Paolo On Tue, Jan 21, 2020 at 11:03:03AM +0100, Mikhail Sennikovsky wrote: > Hi Paolo, > > The pm_pcap_cb has however its own instance of struct plugin_requests > req : > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L51 > , > and noone zeroes it up before using it seems. > > Mikhail > > On Tue, 21 Jan 2020 at 02:25, Paolo Lucente wrote: > > > > > > Hi Mikhail, > > > > If you see all the daemons that make use of the 'req' structure have a > > memset() for 'req' shortly after its declaration. For example here in > > pmacctd: https://github.com/pmacct/pmacct/blob/master/src/pmacctd.c#L360 > > > > Paolo > > > > On Fri, Jan 17, 2020 at 07:10:13PM +0100, Mikhail Sennikovsky wrote: > > > Hi all, > > > > > > I was running through the pm_pcap_cb code, and it looks like the "req" > > > passed to exec_plugins(&pptrs, &req); at > > > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L167 > > > and to load_id_file at > > > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L179 > > > and below > > > is actually uninitialized. (See struct plugin_requests req; at > > > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L51 > > > ) > > > Note that the exec_plugins and load_id_file actually read from req > > > rather than write to it. > > > If I'm getting this right, that code might be working just by coincidence. > > > > > > Thanks, > > > Mikhail > > > > > > ___ > > > pmacct-discussion mailing list > > > http://www.pmacct.net/#mailinglists > > > > ___ > > pmacct-discussion mailing list > > http://www.pmacct.net/#mailinglists ___ pmacct-discussion mailing list http://www.pmacct.net/#mailinglists
Re: [pmacct-discussion] uninitialized req passed to plugin_requests and load_id_file in pm_pcap_cb??
Hi Paolo, The pm_pcap_cb has however its own instance of struct plugin_requests req : https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L51 , and noone zeroes it up before using it seems. Mikhail On Tue, 21 Jan 2020 at 02:25, Paolo Lucente wrote: > > > Hi Mikhail, > > If you see all the daemons that make use of the 'req' structure have a > memset() for 'req' shortly after its declaration. For example here in > pmacctd: https://github.com/pmacct/pmacct/blob/master/src/pmacctd.c#L360 > > Paolo > > On Fri, Jan 17, 2020 at 07:10:13PM +0100, Mikhail Sennikovsky wrote: > > Hi all, > > > > I was running through the pm_pcap_cb code, and it looks like the "req" > > passed to exec_plugins(&pptrs, &req); at > > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L167 > > and to load_id_file at > > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L179 > > and below > > is actually uninitialized. (See struct plugin_requests req; at > > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L51 > > ) > > Note that the exec_plugins and load_id_file actually read from req > > rather than write to it. > > If I'm getting this right, that code might be working just by coincidence. > > > > Thanks, > > Mikhail > > > > ___ > > pmacct-discussion mailing list > > http://www.pmacct.net/#mailinglists > > ___ > pmacct-discussion mailing list > http://www.pmacct.net/#mailinglists ___ pmacct-discussion mailing list http://www.pmacct.net/#mailinglists
Re: [pmacct-discussion] uninitialized req passed to plugin_requests and load_id_file in pm_pcap_cb??
Hi Mikhail, If you see all the daemons that make use of the 'req' structure have a memset() for 'req' shortly after its declaration. For example here in pmacctd: https://github.com/pmacct/pmacct/blob/master/src/pmacctd.c#L360 Paolo On Fri, Jan 17, 2020 at 07:10:13PM +0100, Mikhail Sennikovsky wrote: > Hi all, > > I was running through the pm_pcap_cb code, and it looks like the "req" > passed to exec_plugins(&pptrs, &req); at > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L167 > and to load_id_file at > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L179 > and below > is actually uninitialized. (See struct plugin_requests req; at > https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L51 > ) > Note that the exec_plugins and load_id_file actually read from req > rather than write to it. > If I'm getting this right, that code might be working just by coincidence. > > Thanks, > Mikhail > > ___ > pmacct-discussion mailing list > http://www.pmacct.net/#mailinglists ___ pmacct-discussion mailing list http://www.pmacct.net/#mailinglists
[pmacct-discussion] uninitialized req passed to plugin_requests and load_id_file in pm_pcap_cb??
Hi all, I was running through the pm_pcap_cb code, and it looks like the "req" passed to exec_plugins(&pptrs, &req); at https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L167 and to load_id_file at https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L179 and below is actually uninitialized. (See struct plugin_requests req; at https://github.com/pmacct/pmacct/blob/d72440dc9a7d0d0a7ed9502f1dd31b90105b1d95/src/nl.c#L51 ) Note that the exec_plugins and load_id_file actually read from req rather than write to it. If I'm getting this right, that code might be working just by coincidence. Thanks, Mikhail ___ pmacct-discussion mailing list http://www.pmacct.net/#mailinglists