Victor Julien [Sun, 19 Apr 2020 09:56:58 +0000 (11:56 +0200)]
ssl: improve 'first cert' check to avoid leaks
In some error conditions, or potentially in case of multiple 'certificate'
records, the extracted subject, issuerdn and serial could be overwritten
without freeing the original memory.
Victor Julien [Fri, 3 Apr 2020 15:03:47 +0000 (17:03 +0200)]
ssl: fix handshake cert buffer sizing
'trec' buffer was not grown properly when it was checked as too small.
After this it wasn't checked again so that copying into the buffer could
overflow it.
Jeff Lucovsky [Thu, 23 Apr 2020 14:07:18 +0000 (10:07 -0400)]
decode/erspan: Warn on ERSPAN Type I config
This commit checks whether pre-6.x settings for ERSPAN Type I are
present. ERSPAN Type I is no longer enabled/disabled through a
configuration setting -- it's always enabled.
When a setting exists to enable/disable ERSPAN Type I decoding, a
warning message is logged.
Enabling/disabling ERSPAN Type I decode has been deprecated in 6.x
Jeff Lucovsky [Fri, 24 Apr 2020 14:28:54 +0000 (10:28 -0400)]
napatech: Correct timestamp rounding issue
This commit fixes the conversion of timestamps. Without the extra
parens, the resulting timestamp value for usecs will be 1 or 0 due to
the operator precedence order (+ takes precedence over ?:)
Phil Young [Fri, 24 Apr 2020 21:43:32 +0000 (17:43 -0400)]
napatech: Restructure Packet/Hostbuffer release
The end-of-processing has been restructured so that Packet and Hostbuffer
data structures are now released within the NapatechReleasePacket() callback
function.
Shivani Bhardwaj [Sat, 21 Dec 2019 07:36:01 +0000 (13:06 +0530)]
src: remove multiple uses of atoi
atoi() and related functions lack a mechanism for reporting errors for
invalid values. Replace them with calls to the appropriate
ByteExtractString* functions.
frank honza [Tue, 14 Apr 2020 10:04:13 +0000 (12:04 +0200)]
rfb: Update incomplete handling in parser.
This commit adds an updated incomplete handling for the RFB-Parser. If
incomplete data is processed, the successfully consumed position and
length of remainder + 1 is returned. If the next packet is not empty
suricata will call the parser again.
This commit is a result of discussion on https://github.com/OISF/suricata/pull/4792.
Shivani Bhardwaj [Wed, 29 Jan 2020 14:50:24 +0000 (20:20 +0530)]
flowbits: Allow support for flowbit ORing
This patch allows to OR multiple flowbits on isset and isnotset flowbit
actions.
e.g.
Earlier in order to check if either fb1 or fb2 was set, it was required
to write two rules,
```
alert ip any any -> any any (msg:\"Flowbit fb1 isset\"; flowbits:isset,fb1; sid:1;)
alert ip any any -> any any (msg:\"Flowbit fb2 isset\"; flowbits:isset,fb2; sid:2;)
```
now, the same can be achieved with
```
alert ip any any -> any any (msg:\"Flowbit fb2 isset\"; flowbits:isset,fb1|fb2; sid:23;)
```
This operator can be used to check if one of the many flowbits is set
and also if one of the many flowbits is not set.
Philippe Antoine [Mon, 16 Mar 2020 13:48:40 +0000 (14:48 +0100)]
ftp: FTPGetAlstateProgress for done port commands
For a done transaction with command PORT,
we expect FTP_STATE_FINISHED
and we got FTP_STATE_PORT_DONE instead
which prevented logging of these transactions
We change the order of the evaluations to get the right result
Victor Julien [Sun, 12 Apr 2020 09:09:34 +0000 (11:09 +0200)]
atomics: add SC_ATOMIC_INITPTR macro
Until now both atomic ints and pointers were initialized by SC_ATOMIC_INIT
by setting them to 0. However, C11's atomic pointer type cannot be
initialized this way w/o causing compiler warnings.
As a preparation to supporting C11's atomics, this patch introduces a
new macro to initialize atomic pointers and updates the relevant callers
to use it.
Jason Ish [Thu, 9 Apr 2020 21:59:23 +0000 (15:59 -0600)]
conf/yaml: limit recursion depth while paring YAML
A deeply nested YAML file can cause a stack-overflow while
reading in the configuration to do the recursive parser. Limit
the recursion level to something sane (128) to prevent this
from happening.
The default Suricata configuration has a recursion level of 128
so there is still lots of room to grow (not that we should).
Victor Julien [Tue, 7 Apr 2020 10:41:12 +0000 (12:41 +0200)]
fuzz: remove UNITTEST dependency
Expose UTH flow builder to new 'FUZZ' define as well. Move UTHbufferToFile
as well and rename it to a more generic 'TestHelperBufferToFile'.
This way UNITTESTS can be disabled. This leads to smaller code size
and more realistic testing as in some parts of the code things
behave slightly differently when UNITTESTS are enabled.