Skip to content

Commit

Permalink
Merge pull request #1163 from OneSignal/activity_id-check
Browse files Browse the repository at this point in the history
activity_id index out of bounds check
  • Loading branch information
fhboswell committed Nov 23, 2022
2 parents fc245c2 + dc12660 commit f5e74a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ -(BOOL)missingAppId {
if ([self.path containsString:@"apps/"]) {
NSArray *pathComponents = [self.path componentsSeparatedByString:@"/"];
NSUInteger x = [pathComponents indexOfObject:@"apps"] + 1; // Find the index that follows "apps" in the path
return ([pathComponents count] < x || [[pathComponents objectAtIndex:x] length] == 0 || [[pathComponents objectAtIndex:x] isEqual: @"(null)"]);
return ([pathComponents count] <= x || [[pathComponents objectAtIndex:x] length] == 0 || [[pathComponents objectAtIndex:x] isEqual: @"(null)"]);
}

return (self.parameters[@"app_id"] == nil || [self.parameters[@"app_id"] length] == 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ + (void)finishExecutingRequest:(OneSignalRequest *)request onSuccess:(OSResultSu
if ([request.urlRequest.URL.absoluteString containsString:@"apps/"]) {
NSArray *pathComponents = [request.urlRequest.URL.absoluteString componentsSeparatedByString:@"/"];
NSUInteger x = [pathComponents indexOfObject:@"apps"] + 1; // Find the index that follows "apps" in the path
if ([pathComponents count] < x || [[pathComponents objectAtIndex:x] length] == 0 || [[pathComponents objectAtIndex:x] isEqual: @"(null)"]) {
if ([pathComponents count] <= x || [[pathComponents objectAtIndex:x] length] == 0 || [[pathComponents objectAtIndex:x] isEqual: @"(null)"]) {
_XCTPrimitiveFail(currentTestInstance, @"All request must include an app_id");
}
} else if (!parameters[@"app_id"]) {
Expand Down

0 comments on commit f5e74a6

Please sign in to comment.