From 4b69b39d39cb3637f122ff99e4cec91e5259f903 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 28 Jul 2024 15:49:01 +0200 Subject: [PATCH] HMS_fetch_rules: Return NULL if the curl connection failed, instead of producing garbled rules --- src/http-mserv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/http-mserv.c b/src/http-mserv.c index d1ef80ae4..9e32f9ea7 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -532,7 +532,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size) if (! hms) return NULL; - if (HMS_do(hms)) + boolean ok = HMS_do(hms); + + if (ok) { char *p = strstr(hms->buffer, "\n\n"); @@ -550,6 +552,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size) HMS_end(hms); + if (!ok) + return NULL; + return buffer; }