Skip to content

Commit

Permalink
* buckets/apr_brigade.c (apr_brigade_split_line): Replace ad-hoc
Browse files Browse the repository at this point in the history
  brigade memory corruption test with APR_BRIGADE_CHECK_CONSISTENCY.


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1914764 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
notroj committed Dec 19, 2023
1 parent bde06d6 commit 1efa47e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions buckets/apr_brigade.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ APR_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
apr_off_t maxbytes)
{
apr_off_t readbytes = 0;
apr_bucket *prev = NULL;

APR_BRIGADE_CHECK_CONSISTENCY(bbIn);

while (!APR_BRIGADE_EMPTY(bbIn)) {
const char *pos;
Expand All @@ -346,10 +347,6 @@ APR_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
apr_bucket *e;

e = APR_BRIGADE_FIRST(bbIn);
if (e == prev) { /* PR#51062: prevent infinite loop on a corrupt brigade */
return APR_EGENERAL; /* FIXME: this should definitely be a "can't happen"! */
}
prev = e;
rv = apr_bucket_read(e, &str, &len, block);

if (rv != APR_SUCCESS) {
Expand Down

0 comments on commit 1efa47e

Please sign in to comment.