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 http_auth_types for :any and :anysafe #291

Merged
merged 1 commit into from
Apr 8, 2016
Merged

Conversation

mkauf
Copy link
Contributor

@mkauf mkauf commented Apr 7, 2016

Curb did not allow negative values for http_auth_types, but the values for
CURLAUTH_ANY and CURLAUTH_ANYSAFE are negative.

This also fixes the bug that curb used :any instead of :anysafe.

(!strncmp("ntlm",node,4)) ? CURLAUTH_NTLM : \
(!strncmp("any",node,3)) ? CURLAUTH_ANY : \
(!strncmp("anysafe",node,7)) ? CURLAUTH_ANYSAFE : 0
(!strcmp("basic",node)) ? CURLAUTH_BASIC : \
Copy link
Owner

Choose a reason for hiding this comment

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

the use of strcmp is unbounded in this case it assumes - the input is null terminated but what if it's not... any reason to replace strncmp with strcmp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

strncmp("any", "anysafe", 3) returns 0, so CURLAUTH_ANY was used for :anysafe.

I have updated the pull request with a less intrusive bugfix: check for "anysafe" first, then for "any".

Curb did not allow negative values for http_auth_types, but the values for
CURLAUTH_ANY and CURLAUTH_ANYSAFE are negative.

This also fixes the bug that curb used :any instead of :anysafe.
@taf2 taf2 merged commit 589b282 into taf2:master Apr 8, 2016
@mkauf mkauf deleted the auth_bugfix branch April 8, 2016 18:29
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.

2 participants