Fix potential OOB in memcmp()

This commit is contained in:
Davide De Rosa 2019-09-17 23:41:35 +02:00
parent d815f5222f
commit d22f40f7e9

View File

@ -270,8 +270,10 @@
- (BOOL)isEqualToData:(NSData *)data
{
NSParameterAssert(data);
NSParameterAssert(data.length <= _count);
if (data.length != _count) {
return NO;
}
return !memcmp(_bytes, data.bytes, _count);
}