8000 Fix LDAP diagnostics message used as format string by olavmrk · Pull Request #208 · go-ldap/ldap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix LDAP diagnostics message used as format string #208

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

Merged
merged 3 commits into from
Mar 4, 2019

Conversation

olavmrk
Copy link
Contributor
@olavmrk olavmrk commented Mar 4, 2019

The GetLDAPError()-function passes the diagnosticMessage error field as the first parameter to fmt.Errorf(). If this message happens to contain a %-character, Go will try to interpret it.

This pull request fixes this by adding a format string as the first argument to fmt.Errorf().

It also adds a couple of tests for the GetLDAPError()-function.

This patch adds a couple of tests for the `GetLDAPError()` function.
The GetLDAPError()-function passes the `diagnosticMessage` error field
as the first parameter to `fmt.Errorf()`. If this message happens to
contain a `%`-character, Go will try to interpret it.

This doesn't directly lead to an error, but results in error messages
containing format string error codes. E.g.:

The error message "Detailed error message %" will result in the error
"Detailed error message %!(NOVERB)".

This patch fixes this by inserting a format string as the first
argument to `fmt.Errorf()`.
Copy link
Member
@johnweldon johnweldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - update this branch and I'll merge it. Thanks

@johnweldon johnweldon merged commit 729c20c into go-ldap:master Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0