From 6d74ff5600c4cea4a0961fcb2e51a0e8702ea413 Mon Sep 17 00:00:00 2001 From: rakslice Date: Thu, 19 Nov 2020 15:54:10 -0800 Subject: [PATCH] fix calculated size --- BasiliskII/src/slirp/socket.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/BasiliskII/src/slirp/socket.c b/BasiliskII/src/slirp/socket.c index 699fda6a..f6a6b6e8 100755 --- a/BasiliskII/src/slirp/socket.c +++ b/BasiliskII/src/slirp/socket.c @@ -72,14 +72,12 @@ int prepare_host_domain_suffixes(char * buf) { if (buf) buf[pos] = '.'; pos++; } - if (buf) { - const char * str_pos = str; - while (*str_pos != '\0') { - buf[pos] = tolower(*str_pos); - ++pos; - ++str_pos; - } - }; + const char * str_pos = str; + while (*str_pos != '\0') { + if (buf) buf[pos] = tolower(*str_pos); + ++pos; + ++str_pos; + } // domain to be checked will be FQDN so suffix must have a trailing dot if (str[strlen(str) - 1] != '.') { if (buf) buf[pos] = '.'; @@ -102,7 +100,8 @@ void load_host_domains() { const int size = prepare_host_domain_suffixes(NULL); char * buf = malloc(size); if (buf) { - prepare_host_domain_suffixes(buf); + const int second_size = prepare_host_domain_suffixes(buf); + assert(size == second_size); host_resolved_domain_suffixes = (const char **) buf; } }