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

Nonce is sometimes shorter than expected #21

Merged
merged 3 commits into from May 24, 2014
Merged

Nonce is sometimes shorter than expected #21

merged 3 commits into from May 24, 2014

Conversation

unknown8063
Copy link

Every once in a while my OAuth requests would fail with an authorization denied error. I eventually noticed that every failed request I sent had a 4 character nonce, which seems a bug since _getNonce() is given a length of 5 in the code.

When $rnum is exactly equal to the length of the string $_nonce_chars, the substring it extracts ends up being the empty string, which causes a shorter nonce than expected. The solution is to restrict $rnum to be between 0 and $cLength-1.

BTW, thanks for the library :)

@unknown8063 unknown8063 changed the title fixed bug where nonce was sometimes 1 character below min Bug where nonce is sometimes shorter than expected May 23, 2014
@unknown8063 unknown8063 changed the title Bug where nonce is sometimes shorter than expected Nonce is sometimes shorter than expected May 23, 2014
@jrconlin
Copy link
Owner

Ugh, sorry about that.

Any reason you're killing the exception logging code?

@unknown8063
Copy link
Author

Sorry, I didn't realize the pull request would grow when I checked in additional changes. I've backed it out.

jrconlin added a commit that referenced this pull request May 24, 2014
Nonce is sometimes shorter than expected
@jrconlin jrconlin merged commit 2815057 into jrconlin:master May 24, 2014
@jrconlin
Copy link
Owner

Cool, thanks!

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.

None yet

2 participants