Skip to content

Commit a504da4

Browse files
committed
Fix segfault if the JSON parser cannot parse the JWKS
Ensure m_cget is still valid when building the exception text with m_cget->get_url().
1 parent e21b2a3 commit a504da4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/scitokens_internal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,12 +734,12 @@ std::unique_ptr<AsyncStatus> Validator::get_public_keys_from_web_continue(
734734
auto metadata = std::string(buffer, len);
735735
picojson::value json_obj;
736736
auto err = picojson::parse(json_obj, metadata);
737-
status->m_cget.reset();
738737
if (!err.empty()) {
739738
throw JsonException("JSON parse failure when downloading from the "
740739
" public key URL " +
741740
status->m_cget->get_url() + ": " + err);
742741
}
742+
status->m_cget.reset();
743743

744744
auto now = std::time(NULL);
745745
// TODO: take expiration time from the cache-control header in the

0 commit comments

Comments
 (0)