Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1867 from CFKevinRef/master

Check CFStringTransform() call for success before using result
  • Loading branch information...
commit 5a6ad27129cef90e158740359edc94f3fbc95599 2 parents 8d094e6 + 885eea0
@mattt mattt authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 AFNetworking/AFURLRequestSerialization.m
View
5 AFNetworking/AFURLRequestSerialization.m
@@ -212,8 +212,9 @@ - (instancetype)init {
if (userAgent) {
if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {
NSMutableString *mutableUserAgent = [userAgent mutableCopy];
- CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false);
- userAgent = mutableUserAgent;
+ if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) {
+ userAgent = mutableUserAgent;
+ }
}
[self setValue:userAgent forHTTPHeaderField:@"User-Agent"];
}
Please sign in to comment.
Something went wrong with that request. Please try again.