Skip to content

Commit d40913e

Browse files
authored
Safely copy MIMEType to prevent use after free (Issue #14734) (#15313)
1 parent d46de63 commit d40913e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ - (void)didCompleteRequestWithResponse:(NSURLResponse *)response error:(NSError
251251
self.responseCode = (int32_t)HTTPResponse.statusCode;
252252
}
253253
self.responseError = error;
254-
self.responseContentType = response.MIMEType;
254+
// Safely copy MIMEType to prevent use after free
255+
NSString *mime = [response.MIMEType copy];
256+
self.responseContentType = (mime.length ? mime : nil);
255257
[self checkpointState:FPRNetworkTraceCheckpointStateResponseCompleted];
256258

257259
// Send the network trace for logging.

0 commit comments

Comments
 (0)