karishmal / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Index out of bounds error in AuthorizationCodeResponseUrl constructor with empty queryString #525

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new AuthorizationCodeResponseUrl with an empty ("") queryString 
parameter. 

What is the expected output? What do you see instead?
The index out of bounds error will be thrown. Instead the 

What version of the product are you using? 1.9
What is your operating system? Windows 7
What is your IDE? Visual Studio
What is the .NET framework version? 4.5.1

Please provide any additional information below.

The problem is with this line in the constructor in 
Src/GoogleApis.Auth/OAuth2/Responses/AuthorizationCodeResponseUrl.cs:

    queryString[keyValue[0]] = keyValue[1];

When the String.trim() functions are called to parse the string, if there are 
no & in the entire string, or = in a key value pair there will only be one 
element in the keyValue array. An if statement checking to make sure 
keyValue.length == 2 before problem line could solve the problem.

Original issue reported on code.google.com by awilli...@leveragepoint.com on 7 Jan 2015 at 8:55