Skip to content

Commit

Permalink
Merge pull request owasp-modsecurity#3099 from twouters/bugfix/3082
Browse files Browse the repository at this point in the history
Fix possible segfault in collection_unpack
  • Loading branch information
airween authored Mar 3, 2024
2 parents fa48de0 + 31bf935 commit 788c36d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
DD mmm YYYY - 2.9.x (to be released)
-------------------

* Fix possible segfault in collection_unpack
[Issue #3072 - @twouters]
* Set the minimum security protocol version for SecRemoteRules
[Issue security/code-scanning/2 - @airween]
* Allow lua version 5.4
Expand Down
4 changes: 2 additions & 2 deletions apache2/persist_dbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ static apr_table_t *collection_unpack(modsec_rec *msr, const unsigned char *blob
}

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

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

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

0 comments on commit 788c36d

Please sign in to comment.