netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ulogd2 v3 0/2] pcap: prevent crashes when output `FILE *` is null
@ 2023-03-16 11:07 Jeremy Sowden
  2023-03-16 11:07 ` [PATCH ulogd2 v3 1/2] pcap: simplify opening of output file Jeremy Sowden
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jeremy Sowden @ 2023-03-16 11:07 UTC (permalink / raw)
  To: Netfilter Devel

If ulogd2 receives a signal it will attempt to re-open the pcap output
file.  If this fails (because the permissions or ownership have changed
for example), the FILE pointer will be null and when the next packet
comes in, the null pointer will be passed to fwrite and ulogd will
crash.

The first patch simplifies the logic of the code that opens the output
file, and the second avoids closing the existing stream if `fopen`
fails.

Link: https://bugs.launchpad.net/ubuntu/+source/ulogd2/+bug/1429778

Change since v2

 * The first patch is new.
 * In the second patch, just keep the old stream open, rather than
   disabling output and trying to reopen at intervals.

Change since v1

 * Correct subject-prefix.

Jeremy Sowden (2):
  pcap: simplify opening of output file
  pcap: prevent crashes when output `FILE *` is null

 output/pcap/ulogd_output_PCAP.c | 50 +++++++++++++--------------------
 1 file changed, 19 insertions(+), 31 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-03-17 11:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 11:07 [PATCH ulogd2 v3 0/2] pcap: prevent crashes when output `FILE *` is null Jeremy Sowden
2023-03-16 11:07 ` [PATCH ulogd2 v3 1/2] pcap: simplify opening of output file Jeremy Sowden
2023-03-16 11:24   ` Florian Westphal
2023-03-16 11:32     ` Florian Westphal
2023-03-16 19:02   ` Pablo Neira Ayuso
2023-03-16 19:09     ` Jeremy Sowden
2023-03-16 11:07 ` [PATCH ulogd2 v3 2/2] pcap: prevent crashes when output `FILE *` is null Jeremy Sowden
2023-03-16 11:36 ` [PATCH ulogd2 v3 0/2] " Florian Westphal
2023-03-16 23:36 ` Florian Westphal
2023-03-17 11:34   ` Jeremy Sowden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).