Skip to content

Commit

Permalink
Prevent nullptr dereference in {MultiPerform,Session}::intercept()
Browse files Browse the repository at this point in the history
  • Loading branch information
h3xOo committed Feb 12, 2025
1 parent 2a147f2 commit 55d6d9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cpr/multiperform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ const std::optional<std::vector<Response>> MultiPerform::intercept() {
}

if (current_interceptor_ != interceptors_.end()) {
if (*current_interceptor_ == nullptr) {
return std::nullopt;
}
auto icpt = current_interceptor_;
// Nested makeRequest() start at first_interceptor_, thus excluding previous interceptors.
first_interceptor_ = current_interceptor_;
Expand Down
3 changes: 3 additions & 0 deletions cpr/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,9 @@ const std::optional<Response> Session::intercept() {
}

if (current_interceptor_ != interceptors_.end()) {
if (*current_interceptor_ == nullptr) {
return std::nullopt;
}
auto icpt = current_interceptor_;
// Nested makeRequest() start at first_interceptor_, thus excluding previous interceptors.
first_interceptor_ = current_interceptor_;
Expand Down

0 comments on commit 55d6d9a

Please sign in to comment.