From 2508c047eb116df36c3189f767313cb65fd5283c Mon Sep 17 00:00:00 2001 From: Rob Percival Date: Thu, 3 Mar 2016 16:08:55 +0000 Subject: [PATCH] Handle empty log name in "enable_logs" line of the CT log file e.g. "enabled_logs = foo,,bar" Reviewed-by: Ben Laurie Reviewed-by: Rich Salz --- crypto/ct/ct_log.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/ct/ct_log.c b/crypto/ct/ct_log.c index 1a98c7a0bd..03cb51ffec 100644 --- a/crypto/ct/ct_log.c +++ b/crypto/ct/ct_log.c @@ -213,8 +213,13 @@ static int ctlog_store_load_log(const char *log_name, int log_name_len, CTLOG_STORE_LOAD_CTX *load_ctx = arg; CTLOG *ct_log; /* log_name may not be null-terminated, so fix that before using it */ - char *tmp = OPENSSL_strndup(log_name, log_name_len); + char *tmp; + /* log_name will be NULL for empty list entries */ + if (log_name == NULL) + return 1; + + tmp = OPENSSL_strndup(log_name, log_name_len); ct_log = ctlog_new_from_conf(load_ctx->conf, tmp); OPENSSL_free(tmp); if (ct_log == NULL) { -- GitLab