BIO_write(out, dkm_bytes, dkm_len);
} else {
hexout = OPENSSL_buf2hexstr(dkm_bytes, dkm_len);
+ if (hexout == NULL) {
+ BIO_printf(bio_err, "Memory allocation failure\n");
+ goto err;
+ }
BIO_printf(out, "%s\n\n", hexout);
}
tid = CRYPTO_THREAD_get_current_id();
hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid));
BIO_snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
- hex, OSSL_trace_get_category_name(category));
+ hex == NULL ? "<null>" : hex,
+ OSSL_trace_get_category_name(category));
OPENSSL_free(hex);
BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
strlen(buffer), buffer);
data = "";
hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid));
BIO_snprintf(buf, sizeof(buf), "%s:error:%s:%s:%s:%s:%d:%s\n",
- hex, lib, func, reason, file, line, data);
+ hex == NULL ? "<null>" : hex, lib, func, reason, file,
+ line, data);
OPENSSL_free(hex);
if (cb(buf, strlen(buf), u) <= 0)
break; /* abort outputting the error report */
hex = OPENSSL_buf2hexstr((const unsigned char *)&m->threadid,
sizeof(m->threadid));
- n = BIO_snprintf(bufp, len, "thread=%s, number=%d, address=%p\n", hex,
- m->num, m->addr);
+ n = BIO_snprintf(bufp, len, "thread=%s, number=%d, address=%p\n",
+ hex == NULL ? "<null>" : hex, m->num, m->addr);
OPENSSL_free(hex);
if (n <= 0)
return;
char *tmp;
if (akeyid->keyid) {
tmp = OPENSSL_buf2hexstr(akeyid->keyid->data, akeyid->keyid->length);
- X509V3_add_value((akeyid->issuer || akeyid->serial) ? "keyid" : NULL, tmp, &extlist);
+ if (tmp == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
+ X509V3_add_value((akeyid->issuer || akeyid->serial) ? "keyid" : NULL,
+ tmp, &extlist);
OPENSSL_free(tmp);
}
if (akeyid->issuer)
extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
if (akeyid->serial) {
tmp = OPENSSL_buf2hexstr(akeyid->serial->data, akeyid->serial->length);
+ if (tmp == NULL) {
+ ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
X509V3_add_value("serial", tmp, &extlist);
OPENSSL_free(tmp);
}