Handle empty log name in "enable_logs" line of the CT log file
authorRob Percival <robpercival@google.com>
Thu, 3 Mar 2016 16:08:55 +0000 (16:08 +0000)
committerRich Salz <rsalz@openssl.org>
Fri, 4 Mar 2016 15:50:10 +0000 (10:50 -0500)
e.g. "enabled_logs = foo,,bar"

Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/ct/ct_log.c

index 1a98c7a..03cb51f 100644 (file)
@@ -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) {