Skip to content

Commit 74db443

Browse files
committed
code: check return value of functions in logout.c
oidc_get_provider_from_session and oidc_refresh_token_grant Signed-off-by: Hans Zandbelt <[email protected]>
1 parent ef27683 commit 74db443

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- code: declare enum members as int so they can be set to OIDC_CONFIG_POS_INT_UNSET without warning
44
- code: declare memcache members as int so they can be set to OIDC_CONFIG_POS_INT_UNSET without warning
55
- code: declare introspection_endpoint_method member as int so it can be set to OIDC_CONFIG_POS_INT_UNSET without warning
6+
- code: check return value of oidc_get_provider_from_session and oidc_refresh_token_grant in logout.c
67

78
12/15/2024
89
- add Coverity Github action

src/handle/logout.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,14 @@ int oidc_logout(request_rec *r, oidc_cfg_t *c, oidc_session_t *session) {
474474
}
475475
}
476476

477-
oidc_get_provider_from_session(r, c, session, &provider);
477+
if (oidc_get_provider_from_session(r, c, session, &provider) == FALSE)
478+
oidc_warn(r, "oidc_get_provider_from_session failed");
478479

479480
if ((provider != NULL) && (oidc_cfg_provider_end_session_endpoint_get(provider) != NULL)) {
480481

481482
if (apr_table_get(r->subprocess_env, OIDC_REFRESH_TOKENS_BEFORE_LOGOUT_ENVVAR) != NULL) {
482-
oidc_refresh_token_grant(r, c, session, provider, NULL, NULL, &id_token_hint);
483+
if (oidc_refresh_token_grant(r, c, session, provider, NULL, NULL, &id_token_hint) == FALSE)
484+
oidc_warn(r, "id_token_hint could not be refreshed before logout");
483485
} else {
484486
id_token_hint = apr_pstrdup(r->pool, oidc_session_get_idtoken(r, session));
485487
}

src/http.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,12 +751,12 @@ static apr_byte_t oidc_http_request(request_rec *r, const char *url, const char
751751

752752
/* setup the buffer where the response data will be written to */
753753
OIDC_HTTP_CURL_SETOPT(CURLOPT_WRITEFUNCTION, oidc_http_response_data);
754-
/* coverity[bad_sizeof] */ \
754+
/* coverity[bad_sizeof] */
755755
OIDC_HTTP_CURL_SETOPT(CURLOPT_WRITEDATA, &d_buf);
756756

757757
/* setup the buffer where the response headers will be written to */
758758
OIDC_HTTP_CURL_SETOPT(CURLOPT_HEADERFUNCTION, oidc_http_response_header);
759-
/* coverity[bad_sizeof] */ \
759+
/* coverity[bad_sizeof] */
760760
OIDC_HTTP_CURL_SETOPT(CURLOPT_HEADERDATA, &h_buf);
761761

762762
#ifndef LIBCURL_NO_CURLPROTO

0 commit comments

Comments
 (0)