Skip to content

Commit 60f0811

Browse files
Fix potential NULL dereference in ngx_http_auth_spnego_store_delegated_creds() (#157)
* Fix incorrect logging in krb5_parse_name() error handling * Fixing null-checking issues * Little fixes
1 parent d476f8d commit 60f0811

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ngx_http_auth_spnego_module.c

+7
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,9 @@ ngx_http_auth_spnego_store_delegated_creds(ngx_http_request_t *r,
813813
ngx_strlen("/") + ngx_strlen(escaped)) +
814814
1;
815815
ccname = (char *)ngx_pcalloc(r->pool, ccname_size);
816+
if (NULL == ccname) {
817+
return NGX_ERROR;
818+
}
816819

817820
ngx_snprintf((u_char *)ccname, ccname_size, "FILE:%s/%*s", P_tmpdir,
818821
ngx_strlen(escaped), escaped);
@@ -850,6 +853,10 @@ ngx_http_auth_spnego_store_delegated_creds(ngx_http_request_t *r,
850853
ngx_http_auth_spnego_set_variable(r, &var_name, &var_value);
851854

852855
ngx_pool_cleanup_t *cln = ngx_pool_cleanup_add(r->pool, 0);
856+
if (NULL == cln) {
857+
return NGX_ERROR;
858+
}
859+
853860
cln->handler = ngx_http_auth_spnego_krb5_destroy_ccache;
854861
cln->data = ccname;
855862
done:

0 commit comments

Comments
 (0)