From 0af37a1bed8e76afe0704ef698291c116ce8f31c Mon Sep 17 00:00:00 2001 From: yrutschle Date: Wed, 29 Jul 2020 22:52:48 +0200 Subject: [PATCH] initialise runtime data, which avoids using bad pointers in tls.c as in issue 273 --- sslh-conf.c | 6 +++--- sslh-conf.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sslh-conf.c b/sslh-conf.c index ae835a7..2fd0eaf 100644 --- a/sslh-conf.c +++ b/sslh-conf.c @@ -1,5 +1,5 @@ /* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README) - * on Wed Jul 29 22:30:25 2020. + * on Wed Jul 29 22:51:16 2020. # conf2struct: generate libconf parsers that read to structs # Copyright (C) 2018-2019 Yves Rutschle @@ -1164,7 +1164,7 @@ static void read_block_init(void* target, config_setting_t* cfg, struct config_d if (setting) len = config_setting_length(setting); } - block = malloc(desc->size * len); + block = calloc(len, desc->size); *(size_t*)(((char*)target) + desc->offset_len) = len; *(void**)(((char*)target) + desc->offset) = block; @@ -1172,7 +1172,7 @@ static void read_block_init(void* target, config_setting_t* cfg, struct config_d break; case CFG_GROUP: - block = malloc(desc->size); + block = calloc(1, desc->size); *(void**)(((char*)target) + desc->offset) = block; TRACE_READ((" sizing for %zu elems ", len)); break; diff --git a/sslh-conf.h b/sslh-conf.h index 5db17c0..9f48cf7 100644 --- a/sslh-conf.h +++ b/sslh-conf.h @@ -1,5 +1,5 @@ /* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README) - * on Wed Jul 29 22:30:25 2020. + * on Wed Jul 29 22:51:16 2020. # conf2struct: generate libconf parsers that read to structs # Copyright (C) 2018-2019 Yves Rutschle