Skip to content

Commit e22b706

Browse files
committed
Re-apply 4f33f5b: fix possible segfault in collection_unpack
The fix from #3082 was lost in merge 649aea7 (2024-04-04) and has been missing from every release v2.9.10 .. v2.9.13. This re-applies the same one-line guard as the original commit by @twouters. Refs: #3082
1 parent 02eed22 commit e22b706

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apache2/persist_dbm.c

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

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

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

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

0 commit comments

Comments
 (0)