Skip to content

Commit

Permalink
Fix a use-after-free bug in peerDigestFetchReply() (#1865)
Browse files Browse the repository at this point in the history
The problem occurred when handling an HTTP 304 cache digest response.

Also removed effectively unused DIGEST_READ_DONE enum value.
  • Loading branch information
eduard-bagdasaryan authored and squid-anubis committed Jul 16, 2024
1 parent 51c8227 commit 61ddaf9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ typedef enum {
DIGEST_READ_NONE,
DIGEST_READ_REPLY,
DIGEST_READ_CBLOCK,
DIGEST_READ_MASK,
DIGEST_READ_DONE
DIGEST_READ_MASK
} digest_read_state_t;

/* CygWin & Windows NT Port */
Expand Down
6 changes: 1 addition & 5 deletions src/peer_digest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,6 @@ peerDigestHandleReply(void *data, StoreIOBuffer receivedData)
case DIGEST_READ_NONE:
break;

case DIGEST_READ_DONE:
return;
break;

default:
fatal("Bad digest transfer mode!\n");
}
Expand Down Expand Up @@ -491,7 +487,7 @@ peerDigestFetchReply(void *data, char *buf, ssize_t size)

// stay with the old in-memory digest
peerDigestFetchStop(fetch, buf, "Not modified");
fetch->state = DIGEST_READ_DONE;
return -1;
} else if (status == Http::scOkay) {
/* get rid of old entry if any */

Expand Down

0 comments on commit 61ddaf9

Please sign in to comment.