Check the return from OPENSSL_buf2hexstr()
[openssl.git] / crypto / err / err_prn.c
index 27e987e0e1f24eac170f94a751a9c617605f9aff..e0184b077120420b1bc72afba73829619ca5c6f8 100644 (file)
@@ -36,7 +36,8 @@ void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u),
             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 */