]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
2 years agompm/ac: work around scan-build warnings
Victor Julien [Fri, 21 Apr 2023 09:13:19 +0000 (11:13 +0200)] 
mpm/ac: work around scan-build warnings

util-mpm-ac.c:531:32: warning: Result of 'malloc' is converted to a pointer of type 'uint16_t[256]', which is incompatible with sizeof operand type 'uint16_t' [unix.MallocSizeof]
        ctx->state_table_u16 = SCMalloc(ctx->state_count *
                               ^~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                 ^~~~~~
util-mpm-ac.c:575:32: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t[256]', which is incompatible with sizeof operand type 'uint32_t' [unix.MallocSizeof]
        ctx->state_table_u32 = SCMalloc(ctx->state_count *
                               ^~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
 #define SCMalloc malloc
                 ^~~~~~
2 warnings generated.

Bug: #3148.

2 years agompm/hs: fix scan-build warning
Victor Julien [Fri, 21 Apr 2023 08:59:19 +0000 (10:59 +0200)] 
mpm/hs: fix scan-build warning

util-mpm-hs.c:340:20: warning: Potential leak of memory pointed to by 'p' [unix.Malloc]
        p->sids[0] = sid;
        ~~~~~~~~~~~^~~~~
1 warning generated.

Incorrect error handling could lead to a memory leak.

2 years agodecode: suppress scan-build warning
Victor Julien [Fri, 21 Apr 2023 08:30:37 +0000 (10:30 +0200)] 
decode: suppress scan-build warning

2 years agosuricata: work around scan-build warnings
Victor Julien [Fri, 21 Apr 2023 08:25:30 +0000 (10:25 +0200)] 
suricata: work around scan-build warnings

suricata.c:691:17: warning: Value stored to 'bits' during its initialization is never read [deadcode.DeadStores]
    const char *bits = "<unknown>-bits";
                ^~~~   ~~~~~~~~~~~~~~~~
suricata.c:692:17: warning: Value stored to 'endian' during its initialization is never read [deadcode.DeadStores]
    const char *endian = "<unknown>-endian";
                ^~~~~~   ~~~~~~~~~~~~~~~~~~
2 warnings generated.

2 years agostream: fix minor scan-build warning
Victor Julien [Fri, 21 Apr 2023 08:21:17 +0000 (10:21 +0200)] 
stream: fix minor scan-build warning

stream-tcp.c:134:14: warning: Value stored to 'presize' during its initialization is never read [deadcode.DeadStores]
    uint64_t presize = SC_ATOMIC_GET(st_memuse);
             ^~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

2 years agoscan-build: treat as debug validate
Victor Julien [Fri, 21 Apr 2023 04:43:17 +0000 (06:43 +0200)] 
scan-build: treat as debug validate

2 years agoeve: no need to check fields
Victor Julien [Thu, 20 Apr 2023 18:23:10 +0000 (20:23 +0200)] 
eve: no need to check fields

Cppcheck 2.10:

src/output-json-dns.c:460:23: warning: Identical inner 'if' condition is always true (outer condition is 'field' and inner condition is 'field!=NULL'). [identicalInnerCondition]
            if (field != NULL)
                      ^
src/output-json-dns.c:458:9: note: outer condition: field
        TAILQ_FOREACH(field, &custom->head, next)
        ^
src/output-json-dns.c:460:23: note: identical inner condition: field!=NULL
            if (field != NULL)
                      ^

src/output-json-email-common.c:408:27: warning: Identical inner 'if' condition is always true (outer condition is 'field' and inner condition is 'field!=NULL'). [identicalInnerCondition]
                if (field != NULL) {
                          ^
src/output-json-email-common.c:407:13: note: outer condition: field
            TAILQ_FOREACH(field, &custom->head, next) {
            ^
src/output-json-email-common.c:408:27: note: identical inner condition: field!=NULL
                if (field != NULL) {
                          ^
src/output-json-email-common.c:430:27: warning: Identical inner 'if' condition is always true (outer condition is 'field' and inner condition is 'field!=NULL'). [identicalInnerCondition]
                if (field != NULL) {
                          ^
src/output-json-email-common.c:429:13: note: outer condition: field
            TAILQ_FOREACH(field, &md5_conf->head, next) {
            ^
src/output-json-email-common.c:430:27: note: identical inner condition: field!=NULL
                if (field != NULL) {
                          ^
src/output-json-http.c:574:27: warning: Identical inner 'if' condition is always true (outer condition is 'field' and inner condition is 'field!=NULL'). [identicalInnerCondition]
                if (field != NULL)
                          ^
src/output-json-http.c:572:13: note: outer condition: field
            TAILQ_FOREACH(field, &custom->head, next)
            ^
src/output-json-http.c:574:27: note: identical inner condition: field!=NULL
                if (field != NULL)
                          ^

2 years agoyaml: fix dead store
Victor Julien [Thu, 20 Apr 2023 17:40:38 +0000 (19:40 +0200)] 
yaml: fix dead store

conf-yaml-loader.c:391:17: warning: Value stored to 'retval' is never read [deadcode.DeadStores]
                retval = -1;
                ^        ~~
1 warning generated.

2 years agodebug: suppress warning for scan-build
Victor Julien [Thu, 20 Apr 2023 17:39:30 +0000 (19:39 +0200)] 
debug: suppress warning for scan-build

app-layer-ssl.c:1497:27: error: call to undeclared function 'RecordAlreadyProcessed'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    DEBUG_VALIDATE_BUG_ON(RecordAlreadyProcessed(ssl_state->curr_connp));
                          ^
1 error generated.

2 years agostream: check debug check for multi-SYN/ACK in TFO
Victor Julien [Tue, 18 Apr 2023 11:48:46 +0000 (13:48 +0200)] 
stream: check debug check for multi-SYN/ACK in TFO

2 years agostream: segment insertion error handling cleanup
Victor Julien [Tue, 18 Apr 2023 11:25:18 +0000 (13:25 +0200)] 
stream: segment insertion error handling cleanup

2 years agodetect/http2.header_name: fix multi buffer setup
Victor Julien [Mon, 17 Apr 2023 18:05:04 +0000 (20:05 +0200)] 
detect/http2.header_name: fix multi buffer setup

2 years agodetect/parse: minor validation code cleanups 8732/head
Victor Julien [Mon, 27 Mar 2023 08:57:03 +0000 (10:57 +0200)] 
detect/parse: minor validation code cleanups

2 years agodetect: add error message for transform w/o matches
Victor Julien [Fri, 24 Mar 2023 16:12:42 +0000 (17:12 +0100)] 
detect: add error message for transform w/o matches

2 years agodetect: pass de_ctx to DetectBufferSetActiveList
Victor Julien [Fri, 24 Mar 2023 15:54:27 +0000 (16:54 +0100)] 
detect: pass de_ctx to DetectBufferSetActiveList

2 years agodetect/http_method: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 16:44:06 +0000 (17:44 +0100)] 
detect/http_method: use list util in tests; cleanups

2 years agodetect/http_header: use list util in tests
Victor Julien [Fri, 17 Mar 2023 16:39:24 +0000 (17:39 +0100)] 
detect/http_header: use list util in tests

Cleanups.

2 years agodetect/http_client_body: use list util in tests
Victor Julien [Fri, 17 Mar 2023 16:36:53 +0000 (17:36 +0100)] 
detect/http_client_body: use list util in tests

Cleanups.

2 years agodetect/isdataat: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 13:54:30 +0000 (14:54 +0100)] 
detect/isdataat: use list util in tests; cleanups

2 years agodetect/tls: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 16:50:27 +0000 (17:50 +0100)] 
detect/tls: use list util in tests; cleanups

2 years agodetect/fast_pattern: use list util
Victor Julien [Fri, 17 Mar 2023 20:18:06 +0000 (21:18 +0100)] 
detect/fast_pattern: use list util

2 years agodetect/byte_extract: use list util in tests
Victor Julien [Fri, 17 Mar 2023 20:06:21 +0000 (21:06 +0100)] 
detect/byte_extract: use list util in tests

2 years agodetect/content: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 20:12:01 +0000 (21:12 +0100)] 
detect/content: use list util in tests; cleanups

2 years agodetect/dnp3: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 13:29:53 +0000 (14:29 +0100)] 
detect/dnp3: use list util in tests; cleanups

2 years agodetect/http_uri: remove obsolete tests; clean up
Victor Julien [Fri, 17 Mar 2023 16:49:24 +0000 (17:49 +0100)] 
detect/http_uri: remove obsolete tests; clean up

2 years agodetect/http_user_agent: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:49:50 +0000 (17:49 +0100)] 
detect/http_user_agent: remove obsolete tests

2 years agodetect/http_stat_msg: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:47:46 +0000 (17:47 +0100)] 
detect/http_stat_msg: remove obsolete tests

2 years agodetect/http_stat_code: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:47:18 +0000 (17:47 +0100)] 
detect/http_stat_code: remove obsolete tests

2 years agodetect/http_server_body: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:45:45 +0000 (17:45 +0100)] 
detect/http_server_body: remove obsolete tests

2 years agodetect/http_raw_header: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:44:57 +0000 (17:44 +0100)] 
detect/http_raw_header: remove obsolete tests

2 years agodetect/http_method: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:43:50 +0000 (17:43 +0100)] 
detect/http_method: remove obsolete tests

2 years agodetect/http_host: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:41:59 +0000 (17:41 +0100)] 
detect/http_host: remove obsolete tests

2 years agodetect/http_header: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:39:03 +0000 (17:39 +0100)] 
detect/http_header: remove obsolete tests

2 years agodetect/http_cookie: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:38:27 +0000 (17:38 +0100)] 
detect/http_cookie: remove obsolete tests

2 years agodetect/http_client_body: remove and update tests
Victor Julien [Fri, 17 Mar 2023 16:27:25 +0000 (17:27 +0100)] 
detect/http_client_body: remove and update tests

2 years agodetect/file_data: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 16:23:39 +0000 (17:23 +0100)] 
detect/file_data: remove obsolete tests

2 years agodetect/uricontent: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 14:55:16 +0000 (15:55 +0100)] 
detect/uricontent: remove obsolete tests

2 years agodetect/replace: reduce sm_lists use
Victor Julien [Fri, 17 Mar 2023 14:48:12 +0000 (15:48 +0100)] 
detect/replace: reduce sm_lists use

2 years agodetect/pkt_data: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 14:46:00 +0000 (15:46 +0100)] 
detect/pkt_data: remove obsolete tests

2 years agodetect/pcre: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 14:10:25 +0000 (15:10 +0100)] 
detect/pcre: remove obsolete tests

2 years agodetect/isdataat: remove obsolete test; reduce sm_lists use
Victor Julien [Fri, 17 Mar 2023 13:55:40 +0000 (14:55 +0100)] 
detect/isdataat: remove obsolete test; reduce sm_lists use

2 years agodetect/ftpbounce: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 13:40:02 +0000 (14:40 +0100)] 
detect/ftpbounce: remove obsolete tests

2 years agodetect/geoip: reduce use of sm_list macro
Victor Julien [Fri, 17 Mar 2023 13:41:28 +0000 (14:41 +0100)] 
detect/geoip: reduce use of sm_list macro

2 years agodetect/dns_query: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 13:30:33 +0000 (14:30 +0100)] 
detect/dns_query: remove obsolete tests

2 years agodetect/distance: reduce use of sm_list macro
Victor Julien [Fri, 17 Mar 2023 13:27:58 +0000 (14:27 +0100)] 
detect/distance: reduce use of sm_list macro

2 years agodetect/dce_stub_data: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 13:35:36 +0000 (14:35 +0100)] 
detect/dce_stub_data: remove obsolete tests

2 years agodetect/dce_stub_data: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 13:26:59 +0000 (14:26 +0100)] 
detect/dce_stub_data: remove obsolete tests

2 years agodetect/content: reduce sm_lists use; remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 13:25:51 +0000 (14:25 +0100)] 
detect/content: reduce sm_lists use; remove obsolete tests

2 years agodetect/byte_test: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 13:23:23 +0000 (14:23 +0100)] 
detect/byte_test: use list util in tests; cleanups

2 years agodetect/byte_math: reduce use of sm_list macro
Victor Julien [Fri, 17 Mar 2023 13:22:40 +0000 (14:22 +0100)] 
detect/byte_math: reduce use of sm_list macro

2 years agodetect/byte_jump: use list util in tests; cleanups
Victor Julien [Fri, 17 Mar 2023 13:19:47 +0000 (14:19 +0100)] 
detect/byte_jump: use list util in tests; cleanups

2 years agodetect/byte_extract: reduce use of sm_list macro
Victor Julien [Fri, 17 Mar 2023 13:14:30 +0000 (14:14 +0100)] 
detect/byte_extract: reduce use of sm_list macro

2 years agodetect/base64_decode: remove obsolete test; test cleanups
Victor Julien [Fri, 17 Mar 2023 13:09:01 +0000 (14:09 +0100)] 
detect/base64_decode: remove obsolete test; test cleanups

2 years agodetect/base64_decode: remove obsolete debug code
Victor Julien [Fri, 17 Mar 2023 13:08:12 +0000 (14:08 +0100)] 
detect/base64_decode: remove obsolete debug code

2 years agodetect/base64_data: remove obsolete tests
Victor Julien [Fri, 17 Mar 2023 13:06:55 +0000 (14:06 +0100)] 
detect/base64_data: remove obsolete tests

2 years agodetect/base64_data: remove use of sm_list macro
Victor Julien [Fri, 17 Mar 2023 13:06:19 +0000 (14:06 +0100)] 
detect/base64_data: remove use of sm_list macro

2 years agodetect/pcre: use util funcs for buffer test
Victor Julien [Mon, 20 Mar 2023 09:47:47 +0000 (10:47 +0100)] 
detect/pcre: use util funcs for buffer test

2 years agodetect: add util funcs to get first and last sigmatch for buffer
Victor Julien [Fri, 17 Mar 2023 17:11:41 +0000 (18:11 +0100)] 
detect: add util funcs to get first and last sigmatch for buffer

2 years agodoc: rules can have http1 as protocol 8727/head
Philippe Antoine [Fri, 7 Apr 2023 12:17:06 +0000 (14:17 +0200)] 
doc: rules can have http1 as protocol

Ticket: #5962

2 years agodetect/content: add negated endswith test
Victor Julien [Fri, 14 Apr 2023 12:17:53 +0000 (14:17 +0200)] 
detect/content: add negated endswith test

2 years agodetect/content: Negated endswith matches
Jeff Lucovsky [Mon, 27 Mar 2023 12:59:46 +0000 (08:59 -0400)] 
detect/content: Negated endswith matches

Issue: 5541

This commit handles negated endswith matches.

2 years agorfb: rustfmt rfb.rs
Haleema Khan [Fri, 7 Apr 2023 00:27:38 +0000 (05:27 +0500)] 
rfb: rustfmt rfb.rs

2 years agorfb: add rfb frames, update tests
Haleema Khan [Fri, 7 Apr 2023 00:26:57 +0000 (05:26 +0500)] 
rfb: add rfb frames, update tests

Adds a PDU frame to the RFB parser.
Update function signature in tests to reflect frames

Ticket: 5717

2 years agodetect/app-layer-protocol: remove use of sm_list macro
Victor Julien [Fri, 17 Mar 2023 13:04:26 +0000 (14:04 +0100)] 
detect/app-layer-protocol: remove use of sm_list macro

2 years agodetect: reduce sm_lists macro use
Victor Julien [Fri, 17 Mar 2023 16:46:32 +0000 (17:46 +0100)] 
detect: reduce sm_lists macro use

2 years agodetect/parse: remove obsolete and commented out code
Victor Julien [Fri, 17 Mar 2023 14:09:02 +0000 (15:09 +0100)] 
detect/parse: remove obsolete and commented out code

2 years agodetect/pcre: add comment indicating rawbytes is a no-op
Victor Julien [Wed, 15 Mar 2023 09:22:09 +0000 (10:22 +0100)] 
detect/pcre: add comment indicating rawbytes is a no-op

2 years agodetect/content: remove commented tests
Victor Julien [Fri, 10 Mar 2023 19:54:45 +0000 (20:54 +0100)] 
detect/content: remove commented tests

2 years agodetect/bytemath: fix newline in debug message
Victor Julien [Wed, 8 Mar 2023 14:22:20 +0000 (15:22 +0100)] 
detect/bytemath: fix newline in debug message

2 years agonfs: fix newline in debug messages
Victor Julien [Wed, 8 Mar 2023 14:21:39 +0000 (15:21 +0100)] 
nfs: fix newline in debug messages

2 years agodetect/content: cleanup content setup/check code
Victor Julien [Tue, 21 Mar 2023 05:37:19 +0000 (06:37 +0100)] 
detect/content: cleanup content setup/check code

Pass SigMatch pointer instead of a list id to SigParseRequiredContentSize.

2 years agodoc/byte_math: Add divide by 0 discussion. 8723/head
Jeff Lucovsky [Thu, 30 Mar 2023 13:48:47 +0000 (09:48 -0400)] 
doc/byte_math: Add divide by 0 discussion.

Issue: 5945

2 years agodetect/byte_math: fix bug in byte_math detection
Jeff Lucovsky [Tue, 28 Mar 2023 14:24:57 +0000 (10:24 -0400)] 
detect/byte_math: fix bug in byte_math detection

Issue: 5945

Avoid division by zero when the byte_math operation is division and the
rvalue is 0.

2 years agopcap: fix return check 8716/head
Victor Julien [Wed, 12 Apr 2023 17:21:53 +0000 (19:21 +0200)] 
pcap: fix return check

The check that meant to check if pcap_dispatch processed fewer packets
than the desired number was inaccurate. It would also include all errors
(negative return values).

This patch considers only positive values for this check.

Fixes: 9fe08f2374f6 ("pcap: improve pcap_breakloop support")
2 years agosmtp: enforce line limit even when LF is found 8713/head
Shivani Bhardwaj [Tue, 4 Apr 2023 06:28:42 +0000 (11:58 +0530)] 
smtp: enforce line limit even when LF is found

Before:
If LF character was found, so far, we won't enforce the line limit on
the line. We only enforced limits in case of LF character missing in a
long line.

After this patch:
Line limit is enforced on the line if it is bigger than 4096 Bytes
irrespective of whether LF was found or not.

Redmine Bug: 5819

2 years agoutil/mime: allow delim len 0 when line limit is hit
Shivani Bhardwaj [Tue, 4 Apr 2023 06:13:21 +0000 (11:43 +0530)] 
util/mime: allow delim len 0 when line limit is hit

2 years agosmtp: move constant declaration to header
Shivani Bhardwaj [Thu, 6 Apr 2023 12:14:49 +0000 (17:44 +0530)] 
smtp: move constant declaration to header

2 years agodetect/iponly: remove DetectEngineIPOnlyThreadCtx
Justin Azoff [Tue, 28 Feb 2023 22:54:26 +0000 (17:54 -0500)] 
detect/iponly: remove DetectEngineIPOnlyThreadCtx

This is unused.

Issue: 4578

2 years agodetect/iponly: Reduce the size of the SigNumArray bitsets
Justin Azoff [Sat, 18 Feb 2023 02:11:46 +0000 (21:11 -0500)] 
detect/iponly: Reduce the size of the SigNumArray bitsets

Instead of tracking ip only rules by the internal signum, track them by
a separate counter that starts at zero.  This results in dense
SigNumArrays instead of sparse ones and a much smaller max_idx.

Issue: 4578

2 years agopcap: improve pcap_breakloop support 8706/head
Victor Julien [Tue, 11 Apr 2023 09:40:35 +0000 (11:40 +0200)] 
pcap: improve pcap_breakloop support

When pcap_breakloop has been issued on a handle, the current pcap_dispatch
call may return -2 (PCAP_ERROR_BREAK), but it can also return the number
of processed packets if lower than the desired number. So add this condition
as a check.

2 years agodetect: only breakloop threads that are lagging
Victor Julien [Thu, 6 Apr 2023 14:06:34 +0000 (16:06 +0200)] 
detect: only breakloop threads that are lagging

Sleep after all threads have been checked.

Bug: #5969.

2 years agoflow/worker: refresh detect thread during housekeeping
Victor Julien [Thu, 6 Apr 2023 13:43:41 +0000 (15:43 +0200)] 
flow/worker: refresh detect thread during housekeeping

During housekeeping multiple flows are processed. If a rule reload happens
at that time, we need to use the new detect thread as soon as possible.

Bug: #5969.

2 years agoflow/worker: remove unused detect thread arg
Victor Julien [Thu, 6 Apr 2023 13:31:12 +0000 (15:31 +0200)] 
flow/worker: remove unused detect thread arg

2 years agohttp2: faster when reducing dynamic headers size 8688/head
Philippe Antoine [Thu, 16 Mar 2023 08:20:40 +0000 (09:20 +0100)] 
http2: faster when reducing dynamic headers size

avoid quadratic complexity from removing the first element
and copying all the contents a big number fo times.

Ticket: #5909

2 years agohttp: fix multipart completion 8682/head
Philippe Antoine [Fri, 31 Mar 2023 18:06:13 +0000 (20:06 +0200)] 
http: fix multipart completion

As brought by commit 578f328e06b3e03f3bdbbf852b5d121e20849b8b

Ticket: #5952

2 years agonetmap: Forward port packet stall fix 8677/head
Jeff Lucovsky [Sat, 1 Apr 2023 13:47:56 +0000 (09:47 -0400)] 
netmap: Forward port packet stall fix

Issue: 5862

This commit forward ports fixes from master-6.0.x that address packet
stalling that may occur under IPS configurations.

2 years agoapp-layer-dnp3: Fix build for big endian
Cole Dishington [Fri, 31 Mar 2023 00:40:51 +0000 (13:40 +1300)] 
app-layer-dnp3: Fix build for big endian

Add missing include of util-byte.h for big endian targets that need
SCByteSwap(16|32|64) for DNP3_SWAP(16|32|64).

2 years agouserguide/muti-tenant: fix typo
Juliana Fajardini [Mon, 3 Apr 2023 14:48:21 +0000 (11:48 -0300)] 
userguide/muti-tenant: fix typo

2 years agodoc: add tenant id value requirement
jason taylor [Thu, 30 Mar 2023 13:53:23 +0000 (13:53 +0000)] 
doc: add tenant id value requirement

Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years agooutput: fix logic error
Maxim Korotkov [Thu, 16 Feb 2023 17:16:19 +0000 (20:16 +0300)] 
output: fix logic error

The logical error may have been made here. Comparison with the upper
bound of the variable type does not make sense. It may be worth adding
the cast of one of the multiplication operands to the 64-bit type for
avoiding overflow.

Found by Security Code with Svace static analyzer
Bug: #5789

Signed-off-by: Maxim Korotkov <m.korotkov@securitycode.ru>
2 years agostream: improve FIN checking 8675/head
Victor Julien [Mon, 3 Apr 2023 09:50:09 +0000 (11:50 +0200)] 
stream: improve FIN checking

After recent next_seq changes, the FIN checks could be too strict
leading to stalling sessions in IPS mode.

This patch requires a FIN to be >= last ack and <= next_win to be
accepted.

2 years agoutil/base64: don't reset decoded bytes in RFC4648 8660/head
Shivani Bhardwaj [Thu, 9 Mar 2023 07:13:41 +0000 (12:43 +0530)] 
util/base64: don't reset decoded bytes in RFC4648

Old behavior:
With RFC4648, the decoded bytes were reset to 0 in case an unusual
character was encountered in the encoded string. This worked out fine
for small test cases where there weren't many bytes to be decoded.

Problem:
If a big encoded string had a character outside of the base alphabet,
the processing would stop and the number of decoded bytes were set to 0.
However, even though the processing should stop at the invalid
character, the number of decoded bytes should correctly store the bytes
decoded up until the point an invalid characted was encountered.

New behavor:
For any base64 encoded string given to the base64 decoder in RFC4648
mode, we make sure that the number of decoded bytes correctly reflect
the number of bytes processed up until the string was valid. This makes
sure any further calculations/use of the decoded data is done correctly.

Redmine ticket: 5885

2 years agoapp-layer: add direction to transaction creation where needed
Jason Ish [Wed, 15 Mar 2023 22:23:49 +0000 (16:23 -0600)] 
app-layer: add direction to transaction creation where needed

Build on Eric's but set the direction on transaction creation when
needed. I think this makes it a little more clear, and easier to
document when creating single direction transactions.

This also somewhat abstracts the inner-workings of a directional
transaction from the implementation.

Ticket: #4759

2 years agosip: add TX orientation
Eric Leblond [Mon, 23 Jan 2023 21:01:18 +0000 (22:01 +0100)] 
sip: add TX orientation

Set no inspection in the opposite side of the transaction.

Ticket: #5799

2 years agoenip: add TX orientation
Eric Leblond [Mon, 23 Jan 2023 19:08:57 +0000 (20:08 +0100)] 
enip: add TX orientation

Set no inspection in the opposite side of the transaction.

Ticket: #5799

2 years agodnp3: activate unidirectional TX flag
Eric Leblond [Mon, 23 Jan 2023 19:08:07 +0000 (20:08 +0100)] 
dnp3: activate unidirectional TX flag

By implementing the no inspection flag we can now set
the unidirectional TX flag. Which means that the alstate
progress function can now be simplified to always return
1 f the transaction is complete.

Ticket: #5799

2 years agonfs: TX are not unidirectional
Eric Leblond [Mon, 23 Jan 2023 19:07:07 +0000 (20:07 +0100)] 
nfs: TX are not unidirectional

NFS transactions are not unidirectional so we should not declare
them as such.

2 years agoquic: add TX orientation
Eric Leblond [Mon, 23 Jan 2023 19:05:39 +0000 (20:05 +0100)] 
quic: add TX orientation

Set no inspection in the opposite side of the transaction.

Ticket: #5799

2 years agontp: add TX orientation
Eric Leblond [Mon, 23 Jan 2023 19:05:08 +0000 (20:05 +0100)] 
ntp: add TX orientation

Set no inspection in the opposite side of the transaction.

Ticket: #5799

2 years agokrb: add TX orientation
Eric Leblond [Mon, 23 Jan 2023 19:04:26 +0000 (20:04 +0100)] 
krb: add TX orientation

Set no inspection in the opposite side of the transaction.

Ticket: #5799