X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..07691282a056c4efea71e1e505527601e8cc166b:/OSX/libsecurity_apple_x509_tp/lib/cuEnc64.c diff --git a/OSX/libsecurity_apple_x509_tp/lib/cuEnc64.c b/OSX/libsecurity_apple_x509_tp/lib/cuEnc64.c index 879001cd..9d2bbe2d 100644 --- a/OSX/libsecurity_apple_x509_tp/lib/cuEnc64.c +++ b/OSX/libsecurity_apple_x509_tp/lib/cuEnc64.c @@ -260,6 +260,10 @@ unsigned char *cuDec64(const unsigned char *inbuf, bp = news; obuflen = (inlen / 4) * 3; + if(obuflen == 0) { + free(news); + return NULL; + } outbuf = (unsigned char*)malloc(obuflen); outp = outbuf; @@ -408,6 +412,10 @@ static const char *findStr( const char *cp; size_t srchStrLen = strlen(str); char c = str[0]; + + if(!inText) { + return NULL; + } /* last char * we can search in inText for start of str */ const char *endCp = inText + inTextLen - srchStrLen; @@ -439,6 +447,10 @@ static const char *getLine( *consumed = 0; const char *cp = inText; const char *newline = NULL; // if we found a newline, this points to the first one + + if(!inText) { + return NULL; + } while(inTextLen) { char c = *cp;