Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,14 @@ - (void)didCompleteRequestWithResponse:(NSURLResponse *)response error:(NSError
self.responseCode = (int32_t)HTTPResponse.statusCode;
}
self.responseError = error;
// Safely copy MIMEType to prevent use after free
NSString *mime = [response.MIMEType copy];
// Defensive access to MIMEType
NSString *mime = nil;
@try {
// Safely copy MIMEType to prevent use after free
mime = [response.MIMEType copy];
} @catch (NSException *exception) {
mime = nil;
}
self.responseContentType = (mime.length ? mime : nil);
[self checkpointState:FPRNetworkTraceCheckpointStateResponseCompleted];

Expand Down