Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Prevent NPE parsing NULL queries in OAuth2 redirected URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
davivel committed Aug 29, 2017
1 parent 27d3384 commit 91f470b
Showing 1 changed file with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,28 @@ public OAuth2QueryParser() {
public Map<String, String> parse(String query) {
mOAuth2ParsedAuthorizationResponse.clear();

String[] pairs = query.split("&");
int i = 0;
String key = "";
String value;
while (pairs.length > i) {
int j = 0;
String[] part = pairs[i].split("=");
while (part.length > j) {
String p = part[j];
if (j == 0) {
key = p;
} else if (j == 1) {
value = p;
mOAuth2ParsedAuthorizationResponse.put(key, value);
}
if (query != null) {
String[] pairs = query.split("&");
int i = 0;
String key = "";
String value;
while (pairs.length > i) {
int j = 0;
String[] part = pairs[i].split("=");
while (part.length > j) {
String p = part[j];
if (j == 0) {
key = p;
} else if (j == 1) {
value = p;
mOAuth2ParsedAuthorizationResponse.put(key, value);
}

Log_OC.v(TAG, "[" + i + "," + j + "] = " + p);
j++;
Log_OC.v(TAG, "[" + i + "," + j + "] = " + p);
j++;
}
i++;
}
i++;
}

return mOAuth2ParsedAuthorizationResponse;
Expand Down

0 comments on commit 91f470b

Please sign in to comment.