Skip to content

Commit

Permalink
Add null check before base64 encoding cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylinsic committed Apr 18, 2024
1 parent 038d513 commit e2c5933
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ public void doSearch(final LdapContext initCtx, final List<String> baseDNs, fina
}

if (LOG.isOk()) {
LOG.ok("Setting paged request control with page size '{0}' and cookie '{1}'", pageSize - records,
cookie != null ? Base64.getEncoder().encodeToString(cookie) : "");
if (cookie != null) {
LOG.ok("Setting paged request control with page size '{0}' and cookie '{1}'",
pageSize - records,
cookie != null ? Base64.getEncoder().encodeToString(cookie) : "");
}
}
PagedResultsControl pagedResultsControl = new PagedResultsControl(pageSize - records, cookie,
Control.CRITICAL);
Expand Down Expand Up @@ -150,7 +153,11 @@ public void doSearch(final LdapContext initCtx, final List<String> baseDNs, fina
cookie = pagedControl.getCookie();
if (LOG.isOk())
{
LOG.ok("Server returned a paged results control with cookie '{0}'", Base64.getEncoder().encodeToString(cookie));
if (cookie != null) {
LOG.ok("Server returned a paged results control with cookie '{0}'",
Base64.getEncoder().encodeToString(cookie));
}

}

if (pagedControl.getResultSize() > 0) {
Expand Down

0 comments on commit e2c5933

Please sign in to comment.