fix(darwin): logging - potential crash due to mishandled string formats (#286)
This commit is contained in:
@@ -20,9 +20,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)stopDownloadEventForResponse:(NSURLResponse *)response;
|
||||
|
||||
- (void)debugLog:(NSString *)format, ...;
|
||||
- (void)debugLog:(NSString *)message;
|
||||
|
||||
- (void)errorLog:(NSString *)format, ...;
|
||||
- (void)errorLog:(NSString *)message;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
|
||||
using Error = Response::Error;
|
||||
|
||||
if (error) {
|
||||
[MGLNativeNetworkManager.sharedManager errorLog:@"Requesting: %@ failed with error: %@", res.URL.relativePath, error];
|
||||
[MGLNativeNetworkManager.sharedManager errorLog:@"Requesting: %@ failed with error: %@", req.URL, error.debugDescription];
|
||||
|
||||
if (data) {
|
||||
response.data =
|
||||
|
||||
@@ -121,22 +121,12 @@ NSString * const kMGLDownloadPerformanceEvent = @"mobile.performance_trace";
|
||||
[self sendEventForURLResponse:response withAction:@"cancel"];
|
||||
}
|
||||
|
||||
- (void)debugLog:(NSString *)format, ... {
|
||||
va_list formatList;
|
||||
va_start(formatList, format);
|
||||
NSString *formattedMessage = [[NSString alloc] initWithFormat:format arguments:formatList];
|
||||
va_end(formatList);
|
||||
|
||||
MGLLogDebug(formattedMessage);
|
||||
- (void)debugLog:(NSString *)message {
|
||||
MGLLogDebug(message);
|
||||
}
|
||||
|
||||
- (void)errorLog:(NSString *)format, ... {
|
||||
va_list formatList;
|
||||
va_start(formatList, format);
|
||||
NSString *formattedMessage = [[NSString alloc] initWithFormat:format arguments:formatList];
|
||||
va_end(formatList);
|
||||
|
||||
MGLLogError(formattedMessage);
|
||||
- (void)errorLog:(NSString *)message {
|
||||
MGLLogError(message);
|
||||
}
|
||||
|
||||
#pragma mark - Event management
|
||||
|
||||
Reference in New Issue
Block a user