about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@conformal.com>2013-06-25 13:15:38 -0400
committerJosh Rickmar <jrick@conformal.com>2013-06-25 13:15:38 -0400
commitc3b24f19eea3ab03d6d4a150fb054a2feb0735e7 (patch)
tree38dce9f99dc9bc81ecb1bae2df6b17f7dabaf715
parent848866ed4446a47ebbca2a7862430ab43dbda5e6 (diff)
downloadxombrero-c3b24f19eea3ab03d6d4a150fb054a2feb0735e7.tar.gz
Be sure not to malloc nothing
-rw-r--r--xombrero.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/xombrero.c b/xombrero.c
index 350b762..631016e 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -1712,6 +1712,10 @@ save_certs(struct tab *t, gnutls_x509_crt_t *certs,
 		cert_buf_sz = 0;
 		gnutls_x509_crt_export(certs[i], GNUTLS_X509_FMT_PEM,
 		    NULL, &cert_buf_sz);
+		if (cert_buf_sz == 0) {
+			show_oops(t, "no certs found");
+			goto done;
+		}
 		cert_buf = gnutls_malloc(cert_buf_sz * sizeof(char));
 		if (cert_buf == NULL) {
 			show_oops(t, "gnutls_x509_crt_export failed");