Skip to content

Commit 788c36d

Browse files
authored
Merge pull request owasp-modsecurity#3099 from twouters/bugfix/3082
Fix possible segfault in collection_unpack
2 parents fa48de0 + 31bf935 commit 788c36d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
DD mmm YYYY - 2.9.x (to be released)
22
-------------------
33

4+
* Fix possible segfault in collection_unpack
5+
[Issue #3072 - @twouters]
46
* Set the minimum security protocol version for SecRemoteRules
57
[Issue security/code-scanning/2 - @airween]
68
* Allow lua version 5.4

apache2/persist_dbm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ static apr_table_t *collection_unpack(modsec_rec *msr, const unsigned char *blob
5959
}
6060

6161
blob_offset += 2;
62-
if (blob_offset + var->name_len > blob_size) return NULL;
62+
if (var->name_len < 1 || blob_offset + var->name_len > blob_size) return NULL;
6363
var->name = apr_pstrmemdup(msr->mp, (const char *)blob + blob_offset, var->name_len - 1);
6464
blob_offset += var->name_len;
6565
var->name_len--;
6666

6767
var->value_len = (blob[blob_offset] << 8) + blob[blob_offset + 1];
6868
blob_offset += 2;
6969

70-
if (blob_offset + var->value_len > blob_size) return NULL;
70+
if (var->value_len < 1 || blob_offset + var->value_len > blob_size) return NULL;
7171
var->value = apr_pstrmemdup(msr->mp, (const char *)blob + blob_offset, var->value_len - 1);
7272
blob_offset += var->value_len;
7373
var->value_len--;

0 commit comments

Comments
 (0)