X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/fa7225c82381bac4432a6edf16f53b5370238d85..0d4552ce43ff8bf2e8666a9c5c44c3590eb117a8:/OSX/libsecurity_smime/lib/cmscipher.c?ds=sidebyside diff --git a/OSX/libsecurity_smime/lib/cmscipher.c b/OSX/libsecurity_smime/lib/cmscipher.c index a0016873..d511920a 100644 --- a/OSX/libsecurity_smime/lib/cmscipher.c +++ b/OSX/libsecurity_smime/lib/cmscipher.c @@ -102,9 +102,11 @@ DER_GetInteger(SECItem *it) unsigned char *cp = it->Data; unsigned long overflow = 0x1ffUL << (((sizeof(ival) - 1) * 8) - 1); unsigned long ofloinit; + bool isNegative = false; - if (*cp & 0x80) - ival = -1L; + if (*cp & 0x80) { + isNegative = true; + } ofloinit = ival & overflow; while (len) { @@ -119,6 +121,10 @@ DER_GetInteger(SECItem *it) ival |= *cp++; --len; } + + if (isNegative) { + ival *= -1L; + } return ival; }