Commit graph

11634 commits

Author SHA1 Message Date
Jon Siwek
e447ca5eb6 Updating submodule(s).
[nomail]
2020-02-18 14:50:05 -08:00
Jon Siwek
b8497c8245 Merge branch 'dns_memleak' of https://github.com/MaxKellermann/zeek
* 'dns_memleak' of https://github.com/MaxKellermann/zeek:
  analyzer/protocol/dns: fix NSEC3 memory leak
  analyzer/protocol/dns: change runtime check to assert()
  analyzer/protocol/dns: fix memory leak
2020-02-18 12:21:17 -08:00
Jon Siwek
eafcea86d5 Updating submodule(s).
[nomail]
2020-02-18 10:19:51 -08:00
Max Kellermann
957e7d3245 analyzer/protocol/dns: fix NSEC3 memory leak 2020-02-18 09:24:31 +01:00
Max Kellermann
0605ba2824 threading/Queue: lock mutex before notifying the condition_variable
Locking the associated mutex is not strictly mandatory, but not doing
so can easily create race conditions and lockups.
2020-02-16 19:26:44 +01:00
Max Kellermann
59b5e6b7dc Val: use C++ initializers 2020-02-16 19:23:40 +01:00
Max Kellermann
4a5473c572 Val: add BroValUnion constructors
Allows using C++ initializers.
2020-02-16 19:23:37 +01:00
Max Kellermann
5d58dbbd2e Val: reduce duplicate code by using delegating constructors 2020-02-16 19:23:34 +01:00
Max Kellermann
74f93091e6 Val: remove unused default constructors and friend declarations 2020-02-16 19:23:28 +01:00
Max Kellermann
99f1804c62 Val: remove the unnecessary BroValUnion typedef 2020-02-16 19:22:35 +01:00
Max Kellermann
e3c0da2e15 Type: remove unnecessary enum typedefs 2020-02-16 19:22:35 +01:00
Max Kellermann
b1fe483b05 Type: use C++ initializers 2020-02-16 19:22:35 +01:00
Max Kellermann
5b8bd26c72 Type: move code from BroType::BroType() to constexpr functions
Prepare to inline the constructor, which will one day be `constexpr`
(requires moving the `std::string name` field somewhere else).
2020-02-16 19:22:35 +01:00
Max Kellermann
411d048d24 Type: remove useless BroType destructor 2020-02-16 19:22:35 +01:00
Max Kellermann
4e438bf422 Obj: disallow copying BroObj
Copying a BroObj is dangerous, and should only be done with dedicated
(virtual) methods which are implemented by all derived classes.  This
commit avoids unintentional copies.
2020-02-16 19:22:35 +01:00
Max Kellermann
97f07fa727 Obj: use C++ initializers 2020-02-16 19:22:35 +01:00
Max Kellermann
2ac48ff1d4 Obj: make no_location constexpr
This ensures that the variable is initialized at compile time and may
allow the compiler to apply more initializations.
2020-02-16 19:22:35 +01:00
Max Kellermann
aac3de576f analyzer/protocol/dns: change runtime check to assert()
If it were legal to call SendReplyOrRejectEvent() without an
EventHandlerPtr, then this would leak the `question_name` object.  But
this method has just one caller, and it verifies the EventHandlerPtr.
2020-02-16 19:16:20 +01:00
Max Kellermann
dd377fffba analyzer/protocol/dns: fix memory leak
If `dns_TSIG_addl` is not set, then the BroString allocated by
ExtractOctets() leaks.  Therefore, don't ask ExtractOctets() to copy
the data to a BroString if we're not going to use it.

Yet another memory leak (out of way too many) which would have been
prevented by using smart pointers.
2020-02-16 19:12:57 +01:00
Jon Siwek
2a7f2e0217 Updating submodule(s).
[nomail]
2020-02-15 11:10:56 -08:00
Jon Siwek
0d97c721f2 Updating submodule(s).
[nomail]
2020-02-15 11:07:14 -08:00
Jon Siwek
a785212e80 Improve formatting of doubles that are close to integers
Now checks for approximate floating point equality so that more doubles
get properly disambiguated from integers
2020-02-15 00:54:44 -08:00
Jon Siwek
4375aa150f Improve HTTP version number comparisons
Previous use of floating point comparisons was not always stable.
2020-02-14 23:36:59 -08:00
Jon Siwek
11d8b8c040 Fix code format of various reporter btests 2020-02-14 22:03:11 -08:00
Jon Siwek
aa4185cfff Add a 32-bit task to Cirrus CI config 2020-02-14 21:40:36 -08:00
Jon Siwek
8fed26824b Replace va_list fmt() overload with vfmt()
Using an overload that takes a va_list argument potentially causes
accidental misuse on platforms (e.g. 32-bit) where va_list is
implemented as a type that may collide with commonly-used argument
types.

For example:

    char* c = copy_string("hi");
    fmt("%s", (const char*)c);
    fmt("%s", c);

The first fmt() call correctly goes through fmt(const char*, ...) first,
but the second mistakenly goes through fmt(const char*, va_list) first
because variadic function overloads have lower priority during overload
resolution and va_list on a 32-bit system happens to be defined as a
pointer type that can match with "char*" but not "const char*".
2020-02-14 21:40:36 -08:00
Jon Siwek
8e353aafe5 Format tables indexed by patterns consistently across 32-bit/64-bit
Uses a full 64 bit integer for length values regardless of actual size_t
to get consistent results between either 32-bit and 64-bit platforms.
2020-02-14 21:40:36 -08:00
Jon Siwek
a8e137a879 Format interval values consistently across 32-bit/64-bit platforms 2020-02-14 21:40:01 -08:00
Jon Siwek
e896846752 Update libkqueue for a linux bugfix 2020-02-14 21:15:21 -08:00
Tim Wojtulewicz
47d813badc Merge remote-tracking branch 'MaxKellermann/eliminate_code
* MaxKellermann/eliminate_code:
  RE: make the RE_Matcher destructor non-virtual
  analyzer/protocol/smtp: remove unnecessary nullptr check
  analyzer/Manager: remove unnecessary clear() calls from destructor
  analyzer/protocol/http: remove unnecessary empty destructor
  iosource/pcap/Source: remove unused fields `last_hdr`, `last_data`
  iosource/Manager: eliminate two std::string copies
2020-02-14 16:17:31 -07:00
Jon Siwek
b1e96ab952 Fix various format specifiers 2020-02-14 11:10:41 -08:00
Tim Wojtulewicz
cf8496dc0a Merge remote-tracking branch 'MaxKellermann/includes'
* MaxKellermann/includes:
  broker: include cleanup
  file_analysis: include cleanup
  file_analysis/Analyzer: eliminate duplicate constructor
  probabilistic/Topk: include cleanup
  digest: eliminate the "Reporter.h" include
  Val: eliminate the "RE.h" include
  Val: eliminate the "BroString.h" include
  Val: eliminate the "CompHash.h" include
  Val: forward-declare class PDict, reduce includes
  Val: eliminate the "Scope.h" include
2020-02-14 10:30:13 -07:00
Jon Siwek
a5166086db Merge remote-tracking branch 'origin/topic/timw/dict-unit-tests'
* origin/topic/timw/dict-unit-tests:
  Reset the number of entries in a dict when calling Clear()
  Code cleanup in Dict.h
  Add unit testing for the public Dictionary API
2020-02-13 19:34:29 -08:00
Jon Siwek
33c13c3689 Merge remote-tracking branch 'origin/topic/timw/event-mgr-coverity'
* origin/topic/timw/event-mgr-coverity:
  Check for failure when registering event manager with iosource manager (Coverity 1419398)
2020-02-13 17:15:00 -08:00
Max Kellermann
c6ffec02fc broker: include cleanup 2020-02-13 10:12:03 +01:00
Max Kellermann
0cf5799ca6 file_analysis: include cleanup 2020-02-13 10:12:03 +01:00
Max Kellermann
653b3f43e0 file_analysis/Analyzer: eliminate duplicate constructor 2020-02-13 10:12:03 +01:00
Max Kellermann
ace11e74d2 probabilistic/Topk: include cleanup 2020-02-13 10:12:03 +01:00
Max Kellermann
cceb8a1b0c RE: make the RE_Matcher destructor non-virtual
Nobody overrides it.
2020-02-13 09:17:30 +01:00
Max Kellermann
8a74ebf2a9 analyzer/protocol/smtp: remove unnecessary nullptr check 2020-02-13 09:17:08 +01:00
Max Kellermann
87d3192d9b analyzer/Manager: remove unnecessary clear() calls from destructor 2020-02-13 09:16:33 +01:00
Max Kellermann
a8da8cb8e2 analyzer/protocol/http: remove unnecessary empty destructor 2020-02-13 09:16:25 +01:00
Max Kellermann
d1dc70c90f iosource/pcap/Source: remove unused fields last_hdr, last_data 2020-02-13 09:16:15 +01:00
Max Kellermann
4b8b6ec559 iosource/Manager: eliminate two std::string copies 2020-02-13 09:16:00 +01:00
Max Kellermann
5215f4756b digest: eliminate the "Reporter.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
c78fa4bcf9 Val: eliminate the "RE.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
e98cf0a4a0 Val: eliminate the "BroString.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
728184ea93 Val: eliminate the "CompHash.h" include 2020-02-13 09:13:59 +01:00
Tim Wojtulewicz
12230ceb83 Check for failure when registering event manager with iosource manager (Coverity 1419398) 2020-02-12 16:39:00 -08:00
Max Kellermann
4aac78cf29 Val: forward-declare class PDict, reduce includes 2020-02-12 10:10:26 +01:00