Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on close if LDAP initialization failed/when configuration file is not EOL-terminated #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/TRConfigLexer.re
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#define SC(cond) LEXER_SC_ ## cond: LEXER_SC_ ## cond

/* Check for end-of-input */
#define CHECK_EOI() if (_eoi) { return NULL; }
#define CHECK_EOI() if (_cursor >= _limit) { return NULL; }

/* Skip a token */
#define SKIP(cond) CHECK_EOI(); goto LEXER_SC_ ## cond
Expand Down Expand Up @@ -115,10 +115,6 @@
- (void) fill: (int) length {
/* We just need to prevent re2c from walking off the end of our buffer */
assert(_limit - _cursor >= 0);
if (_cursor == _limit) {
/* Save the cursor and signal EOI */
_eoi = _cursor;
}
}

- (TRConfigToken *) scan {
Expand Down
3 changes: 3 additions & 0 deletions src/auth-ldap.m
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ static BOOL pf_open(struct ldap_ctx *ctx) {
{
ldap_ctx *ctx = handle;

if (!ctx)
return;

/* Clean up the configuration file */
[ctx->config release];

Expand Down