Browse code

fixing NULL pointer dereference

Signed-off-by: Steven Morgan <stevmorg@cisco.com>

tomime authored on 2016/08/13 09:14:00
Showing 1 changed files
... ...
@@ -131,6 +131,10 @@ char *cl_base64_encode(void *data, size_t len)
131 131
 
132 132
     /* Ensure we're dealing with a NULL-terminated string */
133 133
     p = (char *)malloc(elen+1);
134
+    if (NULL == p) {
135
+        BIO_free(b64);
136
+        return NULL;
137
+    }
134 138
     memcpy((void *)p, (void *)buf, elen);
135 139
     p[elen] = 0x00;
136 140
     buf = p;