Skip to content

Commit

Permalink
Check an important security function return value in hs.httpserver's …
Browse files Browse the repository at this point in the history
…certificate generator
  • Loading branch information
cmsj committed Sep 27, 2016
1 parent 7a7b50b commit 39aa589
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extensions/httpserver/MYAnonymousIdentity.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ static BOOL generateRSAKeyPair(int sizeInBits,
uint8_t* buf = data.mutableBytes;

// Write the serial number:
SecRandomCopyBytes(kSecRandomDefault, kSerialLength, &buf[kSerialOffset]);
if (SecRandomCopyBytes(kSecRandomDefault, kSerialLength, &buf[kSerialOffset]) != 0) {
NSLog(@"SecRandomCopyBytes() failed");
return nil;
}
buf[kSerialOffset] &= 0x7F; // non-negative

// Write the issue and expiration dates:
Expand Down

0 comments on commit 39aa589

Please sign in to comment.