]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_apple_x509_tp/lib/cuEnc64.c
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_apple_x509_tp / lib / cuEnc64.c
index 879001cd53a9c852da90f75dc691f8a8f0b96a7d..9d2bbe2dca792c30437957fa2133a4a60951448b 100644 (file)
@@ -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;